select * from RoleInfo
left join Role_menuInfo on Role_menuInfo.RoleId=RoleInfo.RoleId
left join MenuInfo on MenuInfo.MenuId=Role_menuInfo.MenuId
left join Role_GongorismpurviewInfo on RoleInfo.RoleId=Role_GongorismpurviewInfo.RoleId
left join GongorismpurviewInfo on GongorismpurviewInfo.GongorismId=Role_GongorismpurviewInfo.GongorismId
如何将这串sql语句转成linq语句???
急!!!!!
from roleI in db.RoleInfo
join role_menu in db.Role_menuInfo on roleI.RoleId equals role_menu.RoleId
into role_menuEmpy
from role_em in role_menuEmpy.DefaultIfEmpty()
join menu in db.MenuInfo on role_em.MenuId equals menu.MenuId
into roleEmpty
from rEmpty in roleEmpty.DefaultIfEmpty()
join role_gong in db.GongorismpurviewInfo on rEmpty.MenuId equals role_gong.MenuId
into roleGong
from rolegong in roleGong.DefaultIfEmpty()
试试看这个
linq中也有left join 但是一般提倡用主表和子表的关系查询。select * from RoleInfo.Role_menuInfo中的RoleInfo.Role_menuInfo关系。