集約ルートとは?
集約ルートとは、データ変更のために1つの単位として扱われる、密に結びついたオブジェクトのクラスターである集約の入口となるエンティティです。外部のコードは、内部のメンバーを直接ではなく、ルートのみを参照します。ルートは集約の不変条件を守り、すべてのトランザクションにわたってクラスター全体が有効な状態を保つようにします。
なぜ重要か
すべての変更をルート経由でルーティングすることで、ビジネスルールを強制する場所と、明確なトランザクション境界が1か所に定まります。呼び出し側が内部オブジェクトを一貫性のない状態に変更するのを防ぎます。
関連ガイド
What Is a Bounded Context?A bounded context is a boundary within a domain model where a particular set of terms and rules apply consist…
What Is a Domain Event?A domain event is a record that something meaningful happened in the business domain, named in past tense and…
What Is the Repository Pattern?The repository pattern provides a collection-like interface for accessing domain objects, hiding the details…