Equivalent to DataLoadOptions for LINQ for objects?

Is there a version of the class DataLoadOptionsthat exists in LINQ to SQL for LINQ to Entities? Basically I want to have one place that stores all the desired boot configuration and should not add calls .Include()to all my LINQ to Entities queries. Or if someone has a better solution, certainly open to this.

TIA,
Benji

+5
source share
2 answers

Personally, I am glad that there is no (official) equivalent to EF DataLoadOptions. What for? A few reasons:

  • , , . MSDN.
  • . a Customer Orders, , Orders ( ). , ( AssociateWith), . , . :
  • : stateful, . DataLoadOptions DataContext , . , . , .

, , EF- DataLoadOptions. , .

, , , . , , "". - -. , , , , , !

+5

Entity Framework ObjectContext. "IQueryable" . :

public IQueryable<Order> Orders {
  get {
    return OrderSet.Include("OrderDetails");
  }
}
+5

All Articles