【Linq】链表时多条件

SQL语句:

SELECT * FROM dbo.PlatformUserOrg A
LEFT JOIN dbo.BusinessPlatformAccount B ON A.AppId=B.AppId AND A.OrgCode=B.Account
WHERE B.AccountType=0

Linq写法:

from orgInfo in db.PlatformUserOrgs
join accountInfo in db.BusinessPlatformAccounts on new { appId = orgInfo.AppId, orgCode = orgInfo.OrgCode } equals new { appId = accountInfo.AppId, orgCode = accountInfo.Account }
into accountResult
from account in accountResult.DefaultIfEmpty()
select orgInfo

 

 

posted @ 2022-07-09 21:21  智者见智  阅读(64)  评论(0编辑  收藏  举报