Entity Framework: How to disable lazy loading for specific query?

c# entity-framework lazy-loading

Question

Is there any way to disable lazy loading for specific query on Entity Framework 6? I want to use it regularly, but sometimes I want to disable it. I'm using virtual properties to lazy load them.

1
82
8/2/2017 10:58:24 PM

Popular Answer

set the following code before the query you want to execute

context.Configuration.LazyLoadingEnabled = false;
73
6/6/2016 9:58:52 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow