【发布时间】:2015-12-07 17:56:00
【问题描述】:
部门类:
public partial class Department
{
public Department()
{
this.Courses = new HashSet<Course>();
}
public int DepartmentID { get; set; }
public string Name { get; set; }
public virtual ICollection<Course> Courses { get; set; }
}
课程类别:
public partial class Course
{
public Course()
{
this.Enrollments = new HashSet<Enrollment>();
this.People = new HashSet<Person>();
}
public int CourseID { get; set; }
public string Title { get; set; }
public int DepartmentID { get; set; }
public virtual Department Department { get; set; }
}
上下文:
如下启用延迟加载。
universityDBContext.Configuration.LazyLoadingEnabled = true;
universityDBContext.Configuration.ProxyCreationEnabled = true;
延迟加载在 Entity Framework 5 中不起作用。请帮助
【问题讨论】:
标签: entity-framework