任何人都可以帮助我解决我的问题.我使用下面给出的代码:
public IEnumerable<InvoiceHeader> Getdata(Expression<Func<InvoiceHeader, bool>> predicate)
{
return AccountsContext.InvoiceHeaders.Include("Company").Include("Currency")
.Include("BusinessPartnerRoleList").Include("DocumentType")
.Where(predicate);
}
Run Code Online (Sandbox Code Playgroud)
.....
在我的代码中我使用如下
Expression<Func<InvoiceHeader, bool>> predicate = PredicateBuilder.True<InvoiceHeader>();
predicate = predicate.And(o => o.CompanyId == oInvoiceHeader.CompanyId);
List<InvoiceHeader> lstInvheader=Getdata(predicate).ToList();
Run Code Online (Sandbox Code Playgroud)
通过这样做,我得到了例外.[System.NotSupportedException] --- {"LINQ to Entities中不支持LINQ表达式节点类型'Invoke'."}