views:

48

answers:

1

Hi all,

I was wondering how I would handle aggregate roots that contain collections with alot 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.

A: 

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

DanP
And this should be implemented in the Repository ( aggregateRootRepository.getChildren(0, 100) ).
Kdeveloper
@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