Linq with entity - DbExpressionBinding需要一个带有ResultType集合的输入表达式。参数名称:输入 [英] Linq with entity - DbExpressionBinding requires an input expression with a collection ResultType. Parameter name: input
本文介绍了Linq with entity - DbExpressionBinding需要一个带有ResultType集合的输入表达式。参数名称:输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用linq将税码,税名和税收作为列表。但它显示以下错误:
DbExpressionBinding需要一个带有ResultType集合的输入表达式。
参数名称:输入
I am trying to get the taxcode, taxname and taxrate as list using linq. But it's showing the following error:
"DbExpressionBinding requires an input expression with a collection ResultType.
Parameter name: input"
UAAPPEntities context;
context=new UAAPPEntities();
var x = from txs in context.OTAXs
where txs.Code.Count()<=1
select new TaxModel{ taxCode=txs.Code, taxName=txs.Name,taxRate=txs.Rate.Value };
taxList = x.ToList();
return taxList;
请帮帮我..
预付谢谢,
Indhu。
推荐答案
hi,
Got solution using the following query:
var x = from t1 in context.OTAXs
group t1.Code by new { t1.Code } into g
where g.Count()<=1
join txs in context.OTAXs on g.Key.Code equals txs.Code
select new TaxModel { taxCode = txs.Code, taxName = txs.Code, description = txs.Code, taxRate = txs.Rate.Value };
Happy coding..
Thanks,
Indhu.
这篇关于Linq with entity - DbExpressionBinding需要一个带有ResultType集合的输入表达式。参数名称:输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文