I'm investigating CompiledQuery performance, but CompiledQuery is allergic to LoadWith.
using (CustomDataContext myDC = new CustomDataContext())
{
DataLoadOptions options = new DataLoadOptions();
options.LoadWith<Customer>(c => c.Orders)
myDC.LoadOptions = options;
IQueryable<Customer> query = myDC.Customers.Where(filterExpr);
List<Customer> result = query.ToList();
return result;
}
This code populates the Orders property of each Customer instance loaded by issuing a left join sql query. How can I rewrite the query without LoadWith to get the same result (Customers have populated Orders property)?