【发布时间】:2015-08-09 00:14:45
【问题描述】:
我正在尝试在 RavenDB 查询中实现以下逻辑,但接收到
System.NotSupportedException: Could not understand expression
与scores.Any 表达式有关。我明白为什么会这样,但我很难想出一个可行的选择。
public IRavenQueryable<Person> Apply(IRavenQueryable<Person> query)
{
var scores = new List<string>();
if (_a) scores.Add("A");
if (_b) scores.Add("B");
if (_c) scores.Add("C");
if (_u)
{
scores.Add("");
scores.Add(" ");
scores.Add("\t");
scores.Add(null);
}
return from p in query
where scores.Any(score => score == p.Score)
select p;
}
【问题讨论】:
标签: ravendb