Thursday, May 08, 2008

Using Stored Procedures that return multiple result sets in LINQ to SQL

DDITDev - LINQ to SQL and multiple result sets in Stored Procedures

"In this post I'm going to demonstrate how you would return and consume multiple result sets from a stored procedure in LINQ to SQL.

...

The first thing we need to do is create a partial class and define a new method returning type ‘IMultipleResults’. I’ve defined the one below to accept one parameter, which is a customerId.

...

As shown above, you call the method you defined, passing in a customer id in this case, which returns you a type of IMultipleResults. From there it’s just a case of calling the ‘GetResult’ method making sure to pass in the type of the object you want.

..."

A pretty short and sweat post on using and consuming multiple result sets from Stored Procedures in LINQ to SQL

No comments: