Is it possible to use LoadWith but specify return fields?
For example, if I have two tables 1) Products 2) Categories
and do something like
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Products>(d => d.Categories);
db.LoadOptions = dlo;
MyDataContext db = new MyDataContext();
var result = from d in db.Products
select d;
when I check the query in the profiler, I see that ALL rows from the category table are returned. All I really need is a "Name" field.
I know that I can rewrite the query using joins, but I need to return the result set as the "Data" data type, so I use LoadWith.
source
share