Aggregate Root references other aggregate roots

后端 未结 3 1311
感情败类
感情败类 2020-11-30 21:10

I\'m currently working a lot with DDD, and I\'m facing a problem when loading/operating on aggregate roots from other aggregate roots.

For each aggregate root in my

3条回答
  •  孤独总比滥情好
    2020-11-30 21:29

    This approach have some issues. first, you should have one repository to each aggregate and its done. having one repository that calls another one is a break on this rule. second, a good practice about aggregate relationship is that one root aggregate should communicate with another root aggregate by its id, not having its reference. doing so, you keep each aggregate independent of another aggregate. keep reference in root aggregate only of the classes that compose the same aggregate.

提交回复
热议问题