DDD modeling, interaction between aggregate roots

前端 未结 1 1278
忘了有多久
忘了有多久 2021-02-06 13:56

\"alt Marked my aggregate roots with 1;2;3. Looks quite nice - almost like grapes.

1条回答
  •  鱼传尺愫
    2021-02-06 14:34

    In this context Country is just a value object, not an entity - much less an aggregate root - so there's no reason to change anything about your design (without more information).

    Additionally, note that the warning you cite pertains to internal members of aggregate roots, not aggregates themselves. There's nothing wrong with maintaining references to aggregates in multiple places. Aggregate roots are supposed to encapsulate child objects so that there's a single place to enforce business rules for related objects.

    You can see this clearly in several places in Evans' "Domain-Driven Design" (a.k.a., "The Blue Book"). For example, see the diagram on page 127 (in the introduction to aggregate roots), which shows a Car aggregate that has a reference to an Engine aggregate.

    0 讨论(0)
提交回复
热议问题