Can I define loadable load in datacontext instead of query?

Is there a way to determine the desired load for the entire data context, so I can specify something like this: "when using this data context when loading, the Client always loads the corresponding City"?

So, something very similar to Options and LoadWith in Linq on Sql.

+3
source share
3 answers

No Entity infrastructure offers the equivalent DataLoadOptionsavailable in Linq-to-Sql. There is no way to define something like LoadWithor AssociateWithglobally.

+3
source

, EF. , , .

- -, - - , . , ( ), , , , .

, , , , ,

+1

DataContext:

public MyDataContext() : 
  base(global::System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString, mappingSource)
{
    DataLoadOptions options = new DataLoadOptions();
    options.LoadWith<Customer>(o => o.City);
    this.LoadOptions = options;
    OnCreated();
}

.

0

All Articles