我有两个linq查询。我想在另一个查询中使用一个查询的结果。无法创建类型'匿名类型'的常量值
var t2s = (from temp3 in _ent.Products
where temp3.Row_Num == 2
select new { temp3.ProductID });
然后我用这个变种在另一个查询:
var _query = (from P1 in _ent.brands
join temp2 in on
new { Produ_ID = (Int32?)P1.Prod_ID }
equals new { Produ_ID = (Int32?)temp2.ProductID }
);
当我本身运行的第一个查询它给了我正确的结果。如果我运行没有join
第二个它给了我正确的结果,但有join
使我有以下错误:
error: Unable to create a constant value of type 'Anonymous type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context
第二个查询中的't2s'在哪里? – 2013-04-10 19:54:19