【问题标题】:Domain Driven Design: Aggregate roots with large collections领域驱动设计:聚合根与大型集合
【发布时间】:2012-07-24 05:05:18
【问题描述】:

我想知道如何处理包含具有大量实体的集合的聚合根。

喜欢:

public class AggregateRoot
{
    public ICollection<Child> Children { get; set; } // 10.000 entities
}

如何查询子集合以获取特定的子项?顺便说一句,我正在使用 Nhibernate。

【问题讨论】:

    标签: nhibernate domain-driven-design


    【解决方案1】:

    您可以为此使用 Nhibernate 的 collection filters,示例请参阅此 similar question

    【讨论】:

    • 这应该在存储库中实现(aggregateRootRepository.getChildren(0, 100))。
    • @Kdeveloper:是的,这就是一般的想法。虽然当这样的情况出现时,你需要问自己“我错过了真正的聚合根吗?”
    猜你喜欢
    • 2010-11-01
    • 1970-01-01
    • 2010-11-30
    • 1970-01-01
    • 2011-04-26
    • 1970-01-01
    • 2013-09-16
    相关资源
    最近更新 更多