EFCore中 join on的不同

当 多条件 left join on 时

LEFT OUTER JOIN

 

on new { u.UserId, ue.ExamId } equals new { sac.UserId, sac.ExamId }
into sac2
from sac in sac2.DefaultIfEmpty()

 

生成Sql 为 有空值判断

 

 ON ([Filter1].[UserId1] = [GroupBy1].[K1]) AND (([Filter1].[ExamId2] = [GroupBy1].[K2]) OR (([Filter1].[ExamId2] IS NULL) AND ([GroupBy1].[K2] IS NULL)))

 

单条件 on 时

sql on 没有空值判断

 

  LEFT OUTER JOIN [dbo].[SysQuestion] AS [Extent3] ON [GroupBy1].[K1] = [Extent3].[QueId]
posted @ 2019-03-25 17:20  Pursue`  阅读(1099)  评论(0编辑  收藏  举报