Entity EF6 opposite of include

c# ef-code-first entity-framework entity-framework-6

Popular Answer

The amusing aspect of slow loading is that you won't load theDoctor Unless you enter the premises. You can do this to ensure that you don't "accidentally" slow load anything.

  1. Delete thevirtual keyword together from the properties you never want to have loaded slowly.

  2. Disable lazy loading for that instance of the context when creating it.DbContext :

    myContext.Configuration.LazyLoadingEnabled = false;

The second option, which gives you the opportunity to choose when to allow or disable lazy loading, is the one I would recommend.

2
3/1/2016 11:49:19 AM


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