2010-09-29 105 views
1

我有一个警告表,它具有1:多映射到设备。这种关系是在一个映射表中传递的。当我尝试产生从映射表到各种资产类型表的左外连接时,出现以下错误:System.Security.VerificationException:操作可能会破坏运行时的稳定性。左外连接上的Linq错误

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} 

我想这可能是一个缩小的问题,所以我Enumarated的IQueryable的,但还是同样的问题。

+0

你试过使用连接而不是from和where子句 – 2010-09-29 16:56:55

回答

0

一件事情跳出我是行

let x = grrepo.getAssetsForGroupID(d.groupID, d.accountID) 

如果d可以为空值(因为它是一个左外连接,因为DefaultIfEmpty的),那么你怎么能访问d.groupID或d.accountID。我认为这是失败的地方,因为它无法从null获得属性/变量。