【发布时间】:2012-11-28 13:52:29
【问题描述】:
我正在尝试使用 IQueryable 表达式执行以下操作:
(from Person p in s
select new
{
label = p.FirstName + " "
+ (string.IsNullOrWhiteSpace(p.MiddleName) ? p.MiddleName + " " : "")
+ p.LastName,
value = p.Id
}).ToList();
我收到以下错误:
LINQ to Entities does not recognize the method 'Boolean
IsNullOrWhiteSpace(System.String)' method, and this method cannot be
translated into a store expression.
解决办法是什么?
【问题讨论】:
标签: linq linq-to-entities iqueryable