关于Linq左连接
关于Linq左连接,linq,Linq,如何通过linq实现???这里回答:对我很有帮助。非常感谢! select A.Name,B.UserId from [dbo].[SentryBoxs] as A left join [dbo].[SentryBoxUsers] as B on A.ID = B.SentryBoxId and B.UserId = '970500c2-51bd-443e-ae10-585455f2b326' var ans = from A in dboSentryBoxs join B
如何通过linq实现???这里回答:对我很有帮助。非常感谢!
select A.Name,B.UserId
from [dbo].[SentryBoxs] as A
left join [dbo].[SentryBoxUsers] as B on A.ID = B.SentryBoxId
and B.UserId = '970500c2-51bd-443e-ae10-585455f2b326'
var ans = from A in dboSentryBoxs
join B in dboSentryBoxUsers on new { A.ID, UserID = "970500c2-51bd-443e-ae10-585455f2b326" } equals new { ID = B.SentryBoxId, B.UserID } into Bjoin
from B in Bjoin.DefaultIfEmpty()
select new { A.Name, B.UserID };