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
。
从查询中删除“where”子句时会出现什么异常? – Dima
发生同样的异常。 – neo