Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Is there a drawback disabling lazy loading for certain query like this:

 bool isLazyLoading = Context.Configuration.ProxyCreationEnabled;
 Context.Configuration.ProxyCreationEnabled = false;

 SomeQuery();

 Context.Configuration.ProxyCreationEnabled = isLazyLoading;
share|improve this question
1  
No, but this suggests that you want to use one context for a "long" time. That is full of drawbacks. – Gert Arnold 20 hours ago

Yes ..try to put also

bool isLazyLoading = Context.Configuration.ProxyCreationEnabled;
 Context.Configuration.ProxyCreationEnabled = false;
Context.Configuration.LazyLoadingEnabled=false; //disable Lazy loading 

 SomeQuery();

 Context.Configuration.ProxyCreationEnabled = isLazyLoading;
Context.Configuration.LazyLoadingEnabled=true; //reactivate
share|improve this answer
1  
Doesn't add anything useful. Disabling ProxyCreationEnabled also disables lazy loading. – Gert Arnold 20 hours ago
    
Are you sure?? ... proxy creation is for other feature of lazy loading...have you tried it? – federico scamuzzi 20 hours ago
1  
Dude, only proxies can execute lazy loading, because they override navigation properties. – Gert Arnold 20 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.