3

I was wondering how I would handle aggregate roots that contain collections with a lot of entities.

Like:

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

How would I query the child collection to get specific children? I am using Nhibernate btw.

Scott Lawrence
  • 6,993
  • 12
  • 46
  • 64
Chris
  • 7,229
  • 7
  • 41
  • 57

1 Answers1

1

You can use Nhibernate's collection filters for this, see this similar question for examples.

Community
  • 1
  • 1
DanP
  • 6,310
  • 4
  • 40
  • 68
  • 1
    And this should be implemented in the Repository ( aggregateRootRepository.getChildren(0, 100) ). – Kdeveloper Oct 23 '10 at 22:13
  • 3
    @Kdeveloper: Yes, that's the general idea. Although when situations like this come up, you need to ask yourself "Am I missing the real aggregate root?" – DanP Oct 24 '10 at 18:33