Entity Framework include with left join is this possible?

后端 未结 3 477
面向向阳花
面向向阳花 2020-12-03 04:43

I have the following tables

  1. ClassRoom (ClassID,ClassName)
  2. StudentClass (StudentID,ClassID)
  3. Student (StudentID,StudentName,Etc..)
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 05:07

    Exactly:

    1. If StudentDescription.StudentId is nullable -> EF performs a LEFT JOIN, i.e. select * from Student s LEFT JOIN StudentDescription sd on s.StudentID=sd.StudentID.
    2. Otherwise EF does INNER JOIN.

提交回复
热议问题