from p in context.ParentCompanies
where p.Name.Contains(e.Filter)
orderby p.Name
select new { Company = p.Name + "," + p.Country };
当我添加p.Country或任何其他属性时,上述linq
查询失败。
例外:
Could not translate expression 'Table(ParentCompany).Where(p =>
p.Name.Contains(Invoke(value(System.Func'1[System.String])))).OrderBy(p
=> p.Name)' into SQL and could not treat it as a local expression
.