I'm trying to upgrade a large application which uses Entity Framework 4 to use Entity Framework 5. I've discovered a function like this:
public FooModel(FooEntity foo)
{
_foo = foo;
_foo.bars.Load(System.Data.Objects.MergeOption.OverwriteChanges);
}
Where foo
and bar
are generated entities, with bar
having a foreign key to foo
.
It seems EF5 no longer has the .Load(MergeOption)
function, and I've never seen it before.
Does anyone know what it does, and what its equivalent is?
https://stackoverflow.com/a/13178313/784908 suggests that Load
is part of DbContext - but my entity container inherits from DbContext, and still isn't available
My best guess is that it is used for Eager loading of the foreign keys (which I need to do, the context is created and disposed of many times in a request, and there is no guarentee it will exist/attached when FooModel is used)
Entity Framework - eager loading of related entities shows I should be using .Include()
, but that function doesn't seem to be available on an actual entity (I think the term is 'materialized query'?)
Thanks for reading