Consider the following stored procedure:
SELECT * FROM Customers;
SELECT Customer.Id, Customer.Name, Order.Total, Order.DateOrdered
FROM Customers INNER JOIN Orders ON Customers.Id = Orders.CustomerId;
The procedure obviously returns two result sets which I'm trying to retrieve with this partial class method:
public partial class DBSproc : DataContext
{
[Function(Name = "dbo.spGetCustomersAndOrders")]
[ResultType(typeof(Customer))]
// What type should I use here for the second resultset?
[ResultType(typeof(... what here? ...))]
public IMultipleResults GetCustomersAndOrders()
{
IExecuteResult result =
this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())));
return (IMultipleResults)(result.ReturnValue);
}
}
I understand the first result set will be mapped to the Customer entity, but what about the second one? The second one is a custom select, combining multiple columns from several tables. I don't have a entity with these properties.
Should I create a dummy entity just for that resultset? I was hoping I could somehow use anonymous types for such ad-hoc queries.
Thanks.