A business invariant is a condition that must remain true for a domain model to represent a valid business state. Preserving it prevents domain objects from becoming inconsistent. section 12.3.2
One seat per ticket
A cinema must prevent one seat from being allocated to multiple tickets. Placing Seat, Row, and ScheduledMovieSeating inside one aggregate lets ScheduledMovieSeating enforce the invariant during a single transaction. section 12.3.2
Use invariants to guide modeling decisions:
- Identify the rule that must never be violated. section 12.3.2
- Keep the information and constraints needed to enforce the rule within one consistency boundary. section 12.3.2 section 12.5
- Apply the constraints in one transaction so related domain objects remain correct together. section 12.3.2
Figure 12.14 Our EventStorm is divided into consistency boundaries (rectangles). Most of the events reside within the Seat allocations context. Two commands and events are from different bounded contexts (rounded corners): Price Calculation and Payments.
Use the consistency-boundary diagram to distinguish the aggregate that protects an invariant from neighboring bounded contexts such as Price Calculation and Payments. section 12.3.2
