With entity framework you can do something like this to load objects for multiple references with a query.
var Customer = context.Customers.Include(x=>x.Orders.Select(y=>y.Items));
It doesn't seem like I can do the same thing with the LoadProperty method. When I already have an object and I need to load some reference data I use LoadProperty.
context.LoadProperty(Customer, x=>x.Orders);
That works. But this throws an error..
context.LoadProperty(Customer, x=>x.Orders.Select(y=>y.Items));
开发者_StackOverflow
And so does this...
context.LoadProperty(Customer.Orders, x=>x.Items);
This is the exception for both cases...
The selector expression for LoadProperty must be a MemberAccess for the property.
No LoadProperty
doesn't allow that. You can try to use approach described in another question.
I had the same problem and ended up looping through the entities and loading them one by one:
EFContext.LoadProperty(primingRunSelector, f => f.PrimingRun);
EFContext.LoadProperty(primingRunSelector.PrimingRun, f => f.PrimingFillbagAssignedTos);
foreach (var primingFillbagAssignedTo in primingRunSelector.PrimingRun.PrimingFillbagAssignedTos) EFContext.LoadProperty(primingFillbagAssignedTo, f => f.PrimingFillbag);
精彩评论