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