I'm using EF 4, inside WCF. I've a SP (executes dynamic sql) on db side that can return n number of columns where n is not certain. So when I do function import and say return type none, it makes the return type as int. And I don't see any other option. I can return xml and do that way but I don't want to deal with xml. I just want its return type to be List<object>
Add a comment
|
1 Answer
In such case you must fall back to ADO.NET and execute stored procedure by SqlCommand + SqlDataReader. EF is not able to handle result set which vary by number of returned columns. Executing SPs in EF is always strongly typed so you must be able to map your returned record to an entity, a complex type or a custom type (EF will materialize record to instance of the type). It is not possible when you don't have fixed number of returned columns and fixed names of columns.