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]

转载于:https://www.cnblogs.com/WNpursue/p/10594977.html

你可能感兴趣的:(EFCore中 join on的不同)