Why the Left Outer join?

后端 未结 3 1863
醉梦人生
醉梦人生 2021-02-20 04:03

weird one. (Probably not weird, at all)

I have 3 objects, Employee, Rota and Department.

public class Employee
{
    public int Id { get; set; }
    publ         


        
3条回答
  •  青春惊慌失措
    2021-02-20 04:42

    I have theory. The left outer join goes away when you turn off change tracking. Also Employee and Rota have references to Department.

    So my theory is that with change tracking on the Entity Framework tries to load all entities with a reference to the department in case it has to cascade an update to department.

    In other words it thinks that a change to a Department could cause a change to the Employee or Rota referencing the department so it loads everything just in case.

提交回复
热议问题