An aggregate groups related domain objects that must be handled together. One object acts as the aggregate root: other objects belong to its context and are managed through it. section 3.1.3
A Taco Cloud order illustrates the boundaries:
- TacoOrder is the aggregate root and holds the order context. section 3.1.3
- Taco belongs to a TacoOrder and cannot exist outside that context. section 3.1.3
- Ingredient objects form separate aggregates and are referenced through IngredientRef rather than included in the order aggregate. section 3.1.3
The aggregate boundary shapes persistence. The application exposes one OrderRepository for TacoOrder, then saves its Taco objects and their IngredientRef rows as part of the same operation. The repository uses generated keys for the order and tacos, while a transaction coordinates the save. section 3.1.4
Saving an order aggregate
Saving a TacoOrder inserts the order first, obtains its database-generated ID, saves each Taco with that order ID, obtains each taco ID, and inserts IngredientRef rows linking ingredients to tacos. section 3.1.4
Use the schema diagram to inspect the aggregate boundary and the separate Ingredient relationship. section 3.1.3


