質問

These are my entities and relations:

enter image description here

NO entity can exist without entity A. When A is deleted all other entities will be deleted too. Therefore A is my aggregate root.

But I am not sure wether

1.) B is also an aggregate root for entity C,D and E 
2.) E is also an aggregate root for entity F

1.) C,D and E can not exist without B being created
2.) F can not exist without E being created

Do I have now 3 aggregate roots and therefore create 3 repositories?

役に立ちましたか?

解決

Without more information regarding your domain it isn't possible to make a suggestion regarding aggregate boundaries. The relationships among entities isn't as relevant as the behaviors associated with entities. A relationship between entities does not automatically translate to an object reference; relationships can also be implemented as repositories.

An aggregate is a consistency boundary. In other words, it aggregates state which must remain consistent upon execution of associated behaviors. In your case, it may very well be that each of those entities is an aggregate. Take a look at effective aggregate design to get a better feel for factoring a domain into aggregates.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top