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
使用Contains和bigint的嵌套LINQ查询_Linq_Contains_Biginteger_Nested Query - Fatal编程技术网

使用Contains和bigint的嵌套LINQ查询

使用Contains和bigint的嵌套LINQ查询,linq,contains,biginteger,nested-query,Linq,Contains,Biginteger,Nested Query,这是我想要的SQL ClearinghouseKey是一个bigint: 内部查询是直接的,并在LINQPad中给出正确的结果: var innerQuery = (from p in Projects join l in LandUseInProjects on p.ClearinghouseKey equals l.ClearinghouseKey where locations.Contains(p.ProjectLo

这是我想要的SQL ClearinghouseKey是一个bigint:

内部查询是直接的,并在LINQPad中给出正确的结果:

var innerQuery = (from p in Projects
                  join l in LandUseInProjects on p.ClearinghouseKey equals l.ClearinghouseKey
                  where locations.Contains(p.ProjectLocationKey) 
                  &&  (landuses.Contains(l.LandUseKey)) 
                  select new { p.ClearinghouseKey  }).Distinct();
但是外部查询给出错误:无法从用法推断来自…Contains.的类型参数:

var returnQuery = from o in OperOutput
                  where (innerQuery).Contains(o.ClearinghouseKey)
                  select o;
是因为ClearinghouseKey是一个bigint吗?还有其他方法写这个查询吗

谢谢,
珍妮

不要使用匿名类型:

select new { p.ClearinghouseKey })
应该是

select p.ClearinghouseKey)

也考虑使用任何替代而不是包含,我没有理由选择一个而不是另一个。

where innerQuery.Any(i => i == o.ClearinghouseKey)

不要使用匿名类型:

select new { p.ClearinghouseKey })
应该是

select p.ClearinghouseKey)

也考虑使用任何替代而不是包含,我没有理由选择一个而不是另一个。

where innerQuery.Any(i => i == o.ClearinghouseKey)