With EF I can return a collection of objects like so
entities.Customers.ToArray();
And I can include other tables, so I can effectively get 2 result sets back in the one query
entities.Customers.Include("Invoice").ToArray();
or if I have some custom SQL I can achive a similar result:
SqlDataReader reader = GetReaderFromSomewhere("SELECT * FROM Customer");
entities.Translate<Customer>(reader).ToArray();
But how do I get multiple results back from my own SQL? What I was thinking was something like this
SqlDataReader reader = GetReaderFromSomewhere("SELECT Customer.Name AS CustomerName, Invoice.Number AS InvoiceNumber FROM Customer JOIN Invoice ON Customer.ID = Invoice.CustomerID");
entities.Translate<Customer>(reader).Include<Invoice>().ToArray();
In the above example I have prefixed all the returned data with the table name so that the Translate method can know which columns belong to which tables. I'm presuming the Tranlate method does not support this but EF must do something similar when the include method is called. So my question is, how can I get the functionality of Include when using Translate?