entity framework 4 - When are navigational properties loaded? -


if entity has fk relationship entity b, , represented navigational property in entity inside ef4, when data entity b loaded? upon creating instance of a, or when b accessed within a?

it depends on loading method:

  • eager loading - query loading contains .include(a => a.b). in such case both , related bs loaded during query execution
  • lazy loading - loaded during first query , if still in scope of living context can trigger lazy loading of b once navigation property accessed first time
  • explicit loading - manually trigger loading calling context.loadproperty(a, "b");

Comments