【发布时间】:2011-04-14 06:16:02
【问题描述】:
我有一个简单的查询,我想这样做:
1) Products 有ChildProducts 有PriceTiers
2) 我想获取所有Category 和ID 为1 且Display = true 的Products。
3) 然后我想包括所有具有Display = true 的ChildProducts。
4) 然后包括PriceTiers 有IsActive = true。
根据我的阅读,EF 不支持带有过滤器的 Eager Loading,因此以下内容将不起作用:
ProductRepository.Query.IncludeCollection(Function(x) x.ChildProducts.Where(Function(y) y.Display).Select(Function(z) z.PriceTiers.Where(Function(q) q.IsActive))).Where(Function(x) x.Categories.Any(Function(y) y.ID = ID)))
有什么建议吗?
【问题讨论】:
-
为什么要针对同一个问题提出多个问题?而且你为什么要一次又一次地这样做?
标签: entity-framework eager-loading