May 27, 2010 at 2:24 PM

I'm currently going through your book and sample application and i'm getting started understanding domain driven design.

There is one section which i find confusing. In the start of you book, you define Aggregates;

"The root of an Aggregate can hold references to the roots of other Aggregates, and objects inside of an Aggregate can hold references to one another, but nothing outside of the Aggregate boundary can access the objects inside of the Aggregate without going through that Aggregate ’ s root object."

But inside ProjectService.cs i find this function:

         public static IList<MarketSegment> GetMarketSegments()
            return ProjectService.projectRepository.FindAllMarketSegments();

Doesn't that confict with the definition of an aggregate?


Jun 19, 2010 at 7:17 PM

I had the same question as i was going over the code. This violates the aggregate root rule in DDD.

Jun 25, 2010 at 1:52 PM
I don't think that this line's of code violates that rule. Please correct me, if i am wrong! But from my point of view, the MarkedSegments does not have an own AggregateRoot. Plus, neither the ProjectService nor the ProjectRepository holds references of MarkedSegments, they only give you access to it. So, i really can't see where the rule violation should be?! cheers, Chris
Jun 25, 2010 at 3:26 PM

It's accesing an object in the aggregate without going through the root object, so to me it looks like it's a violation of the rule. What am I missing?



May 12, 2011 at 6:49 AM

That is correct Chris.  I needed a way to just get the lookup values for the UI dropdown.