LazyLoadingEnabled is specifically set to true to prevent the related entities from loading in the context I'm using.
A drug class has a list of drugidentity objects in it.
public class Drug
{
public virtual List<DrugIdentity> DrugIdentities { get; set; }
}
A specific configuration for the class sets the key and hasmany relationship if I wanted to include the related entity to be loaded.
public DrugConfiguration()
{
this.HasKey(d => d.DrugID);
this.HasMany(d => d.DrugIdentities).WithOptional(d => d.Drug).Map(d => d.MapKey("DrugID"));
}
When the Drug context is loaded using a linq query the object shows it contains related DrugIdentities when it shouldn't.
context.Configuration.LazyLoadingEnabled = true;
var drugs = from d in context.Drug
where d.Active == true
select d;
drugs[0].DrugIdentities Count = 1
I would expect drugs[0].DrugIdentities to equal NULL since lazyloading was set to true?