Last post Sep 26, 2016 08:33 AM by Mikesdotnetting
Sep 25, 2016 07:32 PM|sudip_inn|LINK
see this code
var salesPeople = await context.Database.SqlQuery<SalesPerson>("AllSalesPeople").ToListAsync();
suppose i do not have any class like SalesPerson in project which i can use with
SqlQuery<SalesPerson> but SP return value for ID and Name then how could i read those value ? suppose SP return single row or multiple row. so tell me which any class specifying with
SqlQuery how to read data return by SP ?
discuss with example code. thanks
Sep 26, 2016 08:27 AM|Nan Yu|LINK
Hi sudip_inn ,
Your scenario is to return complex types, you 'd better create a SalesPerson class(has id,name ) to represent the return values .
Sep 26, 2016 08:33 AM|Mikesdotnetting|LINK
You can use the dynamic type: http://stackoverflow.com/questions/26749429/anonymous-type-result-from-sql-query-execution-entity-framework.
But I would create a class that has the necessary properties for the data returned by the query. Otherwise there doesn't seem to be much point in using an ORM.