2

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>

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.