It seems like this way is no longer available.
public ApplicationDbContext()
{
this.Configuration.LazyLoadingEnabled = false;
}
We can disable lazy loading for a particular entity or a context. To turn off lazy loading for a particular property, do not make it virtual. To turn off lazy loading for all entities in the context, set its configuration property to false.
In EF Core: context. ChangeTracker. LazyLoadingEnabled = false; Per this answer.
To disable lazy loading on a specific post or page, open the post or page, and in the “Cache Options” meta box, un-check the “LazyLoad for images” option. Don't forget to publish or update the post or page to save your changes.
Lazy loading means delaying the loading of related data, until you specifically request for it. When using POCO entity types, lazy loading is achieved by creating instances of derived proxy types and then overriding virtual properties to add the loading hook.
Lazy loading does not (currently) exist in EF7, so there is no API to disable it https://github.com/aspnet/EntityFramework/issues/3797
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With