EF 6.1 Difference between ProxyCreationEnabled and LazyLoadingEnabled

c# entity-framework

Question

You can set up the following two arguments in your DbContext:

context.Configuration.ProxyCreationEnabled = true;
context.Configuration.LazyLoadingEnabled = true;

According to what I understand, you must be able to build proxies for the entities in order to enable lazy loading. In other words, to enable sluggish loading, both parameters must be set to true.

1. Why are there two parameters, and why can you configure both of them?

2. What impact would the aforementioned arrangements have?

// Can't create proxies but can lazy load
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.LazyLoadingEnabled = true;

// Can create proxies but can't lazy load
context.Configuration.ProxyCreationEnabled = true;
context.Configuration.LazyLoadingEnabled = false;
1
12
9/8/2014 8:22:04 AM

Popular Answer

AFAIK:

  • lazy loading true and proxy creation true =>
    • change monitoring
    • sluggish loading
  • lazy loading false and proxy creation true =>
    • change monitoring
  • slow loading true and proxy creation false =>
    • ...

msdn, among others, as a reference

10
9/8/2014 8:30:26 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