I’ve created my stored procedure, I’ve created the complex type using the entity model. Now assuming I have successfully established a connection to the database – I’m now ready to run the store procedure and store the rows in a List<ComplexType>. How do I do this in the best, most efficient way? I’m aware that I can iterate through the columns and rows of an SQLDataReader but it sort of feels like I’d be missing the point of the entity framework.
Thanks a lot.
You can add the stored procedure as a function import and then call it in your assembly directly:
If you use OUTPUT parameter in your stored procedure, you need to add ObjectParameters to get the return value. For example,
Here is a live sample:
ReferralVisitors is a Stored Procedure.