Disable lazy loading by default in Entity Framework 4

Posted by Mikey Cee on Stack Overflow See other posts from Stack Overflow or by Mikey Cee
Published on 2010-06-03T15:08:43Z Indexed on 2010/06/03 15:54 UTC
Read the original article Hit count: 453

It seems that lazy loading is enabled by default in EF4. At least, in my project, I can see that the value of

dataContext.ContextOptions.LazyLoadingEnabled

is true by default. I don't want lazy loading and I don't want to have to write:

dataContext.ContextOptions.LazyLoadingEnabled = false;

each time I get a new context. So is there a way to turn it off by default, say, across the whole project?

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about lazy-loading