【发布时间】:2014-11-16 20:17:49
【问题描述】:
我在 RavenDb 商店有以下先验的简单查询:
return _session
.Query<StockKeepingUnit>()
.Where(x => x.QuantityInStock < x.OrderLevel)
.ToList()
.GroupBy(x => x.BrandName);
RavenDb 在 Where 子句中抛出异常:Could not understand expression: .Where(x => (x.QuantityInStock < x.OrderLevel))
我了解问题在于我无法查询比较同一实体上的属性,并在 where “解决”问题之前调用 .ToList(),但效率极低。
执行此查询的正确方法是什么?
【问题讨论】: