1
我如何提供條件在這個查詢與into子句?Linq在哪裏條入
var res = from aa in db.UserMsts.Where(p => p.Id == id)
join bb in db.UserGrpHdrs on aa.usrgrpid equals bb.usrgrpid
join cc in db.UserGrpDtls on aa.usrgrpid equals cc.usrgrpid where cc.pageid == pg
join dd in db.UserPrivHdrs on new { aa.usrgrpid, userid = aa.Id } equals new { dd.usrgrpid, dd.userid } into ddd
from dd in ddd.DefaultIfEmpty()// <== left outer join
//Error in following line
join ee in db.UserPrivDtls on dd.usrprivid equals ee.usrprivid
where ee.pageid == pg into eee // error here at into
from ee in eee.DefaultIfEmpty() // <== left outer join
select new UserPrivDto{
CanAdd = ee.addpriv != null ? ee.addpriv : cc.addpriv,
CanEdit = ee.editpriv != null ? ee.editpriv : cc.editpriv,
CanView = ee.viewpriv != null ? ee.viewpriv : cc.viewpriv,
CanDel = ee.delpriv != null ? ee.delpriv : cc.delpriv,
};
UserPrivDtls必須過濾並且應該與左外部聯接連接。
的誤差是
查詢體必須與選擇子句或組子句
結束。 感謝
你可以使用'db.UserPrivDtls.Where(EE1 => EE1 .pageid == pg)',就像你使用'db.UserMsts.Where'一樣。 –
@GertArnold謝謝它的工作。應該讓它成爲答案。 – Deb