http://blogs.msdn.com/b/dditweb/archive/2008/05/06/linq-to-sql-and-multiple-result-sets-in-stored-procedures.aspx
Similar to this link however the project I'm working on doesn't use the ORM component of LINQ to SQL (we use it more for quickly generating the ADO.Net interface to the db).
Currently, the pattern we follow is:
var result = myDataContext.GetAllCustomersAndOrders();
And the stored procedure looks like this:
Are there extra steps I need to take? Do I need to extend the generated dbml or the data context partial class file?
Hopefully this makes sense... It's a bit difficult to explain and all the examples I've found use the ORM piece of the dbml (dragging and dropping tables onto the dbml designer surface).
Yes, you can do this, but i will require creating a partial class for your dbml.
So, if your dbml file is MyLinqToSQL.dbml
This will create a partial class of MyLinqToSQL.cs.
Now...
All of the resultsets will be returned in a single collection of IQueryable.
You can then use reflection to determine the type of each collection item and then cast them for use.
See http://kishor-naik-dotnet.blogspot.com/2011/12/linq-multiple-result-set-of-procedure.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With