setting context lazyloadingenabled false with eager loading
Posted: Mon 02 May 2011 20:09
using Devart.Data.Oracle.Entity version 6.10.141.0
I'm using some includes to use eager loading. This seems to only work when LazyLoadingEnabled is set to false in the model itself.
If the model has LayLoadingEnabled = true and I set it to false in the below code where I'm doing my queries, it doesn't work. I don't want to disable lazy loading on the model as I only want to use eager loading in a few cases. Are there any workarounds?
ctx.ObjectContext.ContextOptions.LazyLoadingEnabled = false;
var data = ctx.ObjectContext.FullyLoadedCosts.Include("FlcCategory").Include("Transportation").Where(e => regionRoles.Contains(e.Region));
I'm using some includes to use eager loading. This seems to only work when LazyLoadingEnabled is set to false in the model itself.
If the model has LayLoadingEnabled = true and I set it to false in the below code where I'm doing my queries, it doesn't work. I don't want to disable lazy loading on the model as I only want to use eager loading in a few cases. Are there any workarounds?
ctx.ObjectContext.ContextOptions.LazyLoadingEnabled = false;
var data = ctx.ObjectContext.FullyLoadedCosts.Include("FlcCategory").Include("Transportation").Where(e => regionRoles.Contains(e.Region));