entity framework disable lazy loading code example
Example 1: turn off lazy loading in entity framework
this.Configuration.LazyLoadingEnabled = false;
Example 2: turn off lazy loading in entity framework
public partial class SchoolDBEntities : DbContext
{
public SchoolDBEntities(): base("name=SchoolDBEntities")
{
this.Configuration.LazyLoadingEnabled = false;
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
}
}