关于这个问题我已经搜索了很多这里有什么问题
Shorter version of my code is
/// companyid is integer type value here is 220
var cond1 = BuildExpression(companyId);
var acntlst=entities.Accounts.Where(cond).ToList();
Account 是一个查询 Account 集合的类
构建表达式函数
private static Expression<Func<Account, bool>> BuildExpression(string companyid)
{
var paramexp = Expression.Parameter(typeof (Account), "p");
var proprty = typeof(Account).GetProperty("CompanyId");
var prpexp = Expression.Property(paramexp, proprty);
var varexp = Expression.Variable(typeof(Int32), companyid);
var cond1 = Expression.Equal(prpexp, varexp);
return Expression.Lambda<Func<Account, bool>>(cond1,paramexp);
}
错误信息是
The parameter '220' was not bound in the specified LINQ to Entities query expression