我有这个SQL查询:
select RoleID
from tblUserRole
where UserID = 1
and RoleID in
(Select ID from tblGreenRole
Where
IsFullAccess = 1)
如何将此查询转换为linq?
答案 0 :(得分:0)
这样的事情:
var result = (from t1 in context.tblUserRole
join t2 in context.tblGreenRole on t1.RoleID equals t2.ID
where t1.UserID == 1 && t2.IsFullAccess == 1).ToList();
如果IsFullAccess
的类型为bit,则更改为&& t2.IsFullAccess == true
或&& t2.IsFullAccess