I read about the cumulative template, but I'm somewhat confused. The template indicates that all objects belonging to the aggregate should be accessible through the Aggregated Root, and not directly.
And I guess that is why they say that you should have one repository for each aggregate.
But I think this adds a noticeable overhead for the application. For example, in a typical web application, what if I want to get an object belonging to an aggregate (which is NOT an aggregated root)? I will need to call Repository.GetAggregateRootObject (), which loads the aggregate root and all its children, and then iterates over the children to find the one I'm looking for. In other words, I load a lot of data and throw it away, except for the specific object that I am looking for.
Am I missing something here?
PS: I know that some of you may suggest that we can improve performance with Lazy Loading. But this is not what I am asking here ... The aggregate scheme requires that all objects belonging to the aggregate be loaded together, so we can enforce business rules.
source
share