有谁能帮助我解决我的问题。 我正在使用下面给出的代码:
public IEnumerable<InvoiceHeader> Getdata(Expression<Func<InvoiceHeader, bool>> predicate)
{
return AccountsContext.InvoiceHeaders.Include("Company").Include("Currency")
.Include("BusinessPartnerRoleList").Include("DocumentType")
.Where(predicate);
}
我的代码中使用如下:
Expression<Func<InvoiceHeader, bool>> predicate = PredicateBuilder.True<InvoiceHeader>();
predicate = predicate.And(o => o.CompanyId == oInvoiceHeader.CompanyId);
List<InvoiceHeader> lstInvheader=Getdata(predicate).ToList();
这样做会导致异常。[System.NotSupportedException] --- {"The LINQ expression node type 'Invoke' is not supported in LINQ to Entities."}