views:

8

answers:

0

Say I have a stored procedure that returns dataSet from 2 different tables. Example:

SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer
FROM Customers LEFT JOIN Sales
ON Customers.CustomerID = Sales.CustomerID
GROUP BY Customers.FirstName, Customers.LastName 

Is there any way to get a strongly typed list as a result from this stored procedure ? Something like this:

StoredProcedure sp = myDevDB.GetCustomerSales();

List<MyCustomType> resultSet = sp.ExecuteTypedList<MyCustomType>();

How and where do I define the MyCustomType class ? How do I map its properties to the actual table columns ?

Thanks, Zohrab.