You are mixing concepts here.
Aggregate roots has nothing to do with hierarchies structures.
The domain you are showing is the -hello world- of learning what is an
aggregate and what it is not.
Order and Customer are *usually* two different aggregates, while OrderLine
belongs to the Order aggregate.
You have to think what does make more sense for your application and what
thing deserve to be an aggregate root. If you have customers with 10.000
orders Id say; without any doubt, that an "order" is an important thing in
your system *per-se*.

A worse example of what you are doing will be to nest everything like;
Country => Provinces => Cities => Customer => Orders..
Then if you need to add an order to your system, you use a CountryRepository
to get the country of the customer, find the province of your customer, find
the city, find the customer, and add the order to his order collection. This
does not make sense.

2011/4/26 Stephen Hardie <[email protected]>

> Because making it into it's own aggregate root breaks the domains hierarchy
> structure, which in turn causes the domain model to be that much more
> difficult to understand and follow.
>
>
> On Tue, Apr 26, 2011 at 4:14 AM, José F. Romaniello <
> [email protected]> wrote:
>
>> Order is almost always an aggregate root in that example.
>>
>> Why do you think that having Customer -> Orders (10000) is less uglier
>> than having Order as aggregate root?
>>
>>
>>
>>
>> 2011/4/26 Kinstephen <[email protected]>
>>
>>> as Customer ->
>>> Orders (10,000 or more records/entities)
>>>
>> ...
>>
>> And the only work around architecturally is to make Orders into an
>>> aggregate root of it's own and then use IQuery to setup paging. To me
>>> this seems rather ugly as it breaks the domain hierarchy up into an
>>> unnatural object model.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to