Domain-Driven Design (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is a Domain Invariant?
junior Leveldomain-driven-designBasic
In Simple Words: A business rule that must be true at all times within an Aggregate's lifecycle:
- Examples:
- "The total cost of an Order cannot exceed the customer's credit limit."
- "An order cannot have more than 50 items."
- "A shipment cannot be created without at least one item."
- The Aggregate Root is strictly responsible for validating and guaranteeing that invariants are never violated before persisting changes.