Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 左外联接上的Linq错误_C#_Linq - Fatal编程技术网

C# 左外联接上的Linq错误

C# 左外联接上的Linq错误,c#,linq,C#,Linq,我有一个警报表,它有一个到设备的1:many映射。这种关系在映射表中传递。当我尝试从映射表到各种资产类型表生成左外部联接时,我得到以下错误:System.Security.VerificationException:操作可能会破坏运行时的稳定性 var alertAssets = (from a in dc.MSAlert_Assets from b in dc.MSRfids.Where(x => x.accountID ==

我有一个警报表,它有一个到设备的1:many映射。这种关系在映射表中传递。当我尝试从映射表到各种资产类型表生成左外部联接时,我得到以下错误: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获取属性/变量。

您是否尝试过使用join而不是from和where子句