Reputation: 57502
I'm using Entity Framework 6 and I have lazy loading enabled:
When I set my entity class Access to 'public, lazy loading works fine:
In the example above, I'm able to navigate from Address to City.
However, if I change the entity class Access to 'internal', then lazy loading stops working and I can no longer navigate from Address to City if I don't eager load City:
Why does lazy loading stop working for internal classes? Is there a way around this?
Upvotes: 2
Views: 1249
Reputation: 48975
The entity must be public
, it's a requirement for Entity Framework to be able to inherit from it and create a proxy at runtime (that adds all the EF internal stuff in the overridden virtual
navigation properties).
See Requirements for Creating POCO Proxies on MSDN.
Upvotes: 7