Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more conceptual documentation around aggregates #1629

Closed
BahKoo opened this issue Aug 9, 2019 · 2 comments · Fixed by #1906
Closed

Add more conceptual documentation around aggregates #1629

BahKoo opened this issue Aug 9, 2019 · 2 comments · Fixed by #1906

Comments

@BahKoo
Copy link

BahKoo commented Aug 9, 2019

The documentation makes the following claim about references from owned types:

In addition to nested owned types, an owned type can reference a regular entity, it can be either the owner or a different entity as long as the owned entity is on the dependent side.

It is not made clear why the owned entity must be on the dependent side of the relationship. Is this limitation by-design or a current shortcoming?

A concrete example of a scenario that would benefit from this capability was outlined in the stackoverflow question:
https://stackoverflow.com/q/54647000/2196664

When talking about DDD, having value objects reference a collection of entities does not seem to be a restriction:

VALUE OBJECTS can even reference ENTITIES. For example, if I ask an online map service for a
scenic driving route from San Francisco to Los Angeles, it might derive a Route object linking L.A.
and San Francisco via the Pacific Coast Highway. That Route object would be a VALUE, even though
the three objects it references (two cities and a highway) are all ENTITIES.
-- Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software, page 98


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@AndriySvyryd
Copy link
Member

This is by design. Owned types are part of an aggregate and only the aggregate root can be referenced from outside.

VALUE OBJECTS can even reference ENTITIES. For example, if I ask an online map service for a
scenic driving route from San Francisco to Los Angeles, it might derive a Route object linking L.A.
and San Francisco via the Pacific Coast Highway. That Route object would be a VALUE, even though
the three objects it references (two cities and a highway) are all ENTITIES.
-- Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software, page 98

This doesn't say that Route is the principal, it has three references to three entities.

@BahKoo
Copy link
Author

BahKoo commented Aug 9, 2019

On closer inspection of my model, I think that table splitting is a better fit for my problem than owned entities. Thanks for the feedback.

@ajcvickers ajcvickers changed the title Please clarify references to entities from owned types Add more conceptual documentation around aggregates Sep 2, 2019
@ajcvickers ajcvickers added this to the Backlog milestone Sep 2, 2019
@AndriySvyryd AndriySvyryd modified the milestones: Backlog, 3.1.0 Nov 6, 2019
AndriySvyryd added a commit that referenced this issue Nov 6, 2019
AndriySvyryd added a commit that referenced this issue Nov 10, 2019
AndriySvyryd added a commit that referenced this issue Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants