[英]Linq Error on Left outer join
我有一個警報表,其中有一個1:許多映射到設備的表。 此關系在映射表中傳達。 當我嘗試從映射表到各種資產類型表生成左外部聯接時,出現以下錯誤:System.Security.VerificationException:操作可能會使運行時不穩定。
var alertAssets = (from a in dc.MSAlert_Assets
from b in dc.MSRfids.Where(x => x.accountID == a.accountID && x.rfID == a.tagNum && x.custNum == a.custNum).DefaultIfEmpty()
from c in dc.MSDevices.Where(x => x.accountID == a.accountID && x.deviceID == a.deviceID).DefaultIfEmpty()
from d in dc.MSGroups.Where(x => x.accountID == a.accountID && x.groupID == a.groupID).DefaultIfEmpty()
let x = grrepo.getAssetsForGroupID(d.groupID, d.accountID)
where a.alertID == alertID
select new {... specific objects}
我認為這可能是一個縮小的問題,因此我對IQueryable進行了編號,但仍然是相同的問題。
跳到我身上的一件事是線
let x = grrepo.getAssetsForGroupID(d.groupID, d.accountID)
如果d可以為null(由於DefaultIfEmpty而由於它是左外部聯接),那么如何訪問d.groupID或d.accountID。 我認為那是失敗的地方,因為它無法從null獲得屬性/變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.