Yes, you can do this, but I will need to create a partial class for your dbml.
So, if your dbml file is MyLinqToSQL.dbml
- open dbml constructor
- drag SP to the design surface.
- save
- and then press F7.
This will create a partial class MyLinqToSQL.cs.
Now...
- open the automatically generated file MyLinqToSQL.designer.cs
- copy the access method with the same name as SP (the one from which you want to return multiple sets from.)
- Insert this into the body of the partial class in the MyLinqToSQL.cs that you just created.
- change the method name to something at least slightly different
- change the return type from ISingleResult to IMultipleResult.
- decorate your new class with System.Data.Linq.Mapping.ResultType attributes to determine the types of the returned set.
All results will be returned in one IQueryable collection.
You can then use reflection to determine the type of each item in the collection, and then use them for use.
See http://kishor-naik-dotnet.blogspot.com/2011/12/linq-multiple-result-set-of-procedure.html
source share