I often see the term Invariants in DDD. Here Dino Esposito talks about it. If I look at the .NET library, I see the ValidationAttribute class. Are the Invariants and verification rules the same? For example, can I say that a 50% discount is only available if the total order amount of more than $ 250 is invariant?
Or are they different from where the Invariants should protect the object from invalidity, and the verification consists in checking the validity of the object even after it has changed its state (it may be in a valid or invalid state)? In the above example, if I use invariants, I check the invariant before updating the discount, and in the case of verification, I apply a 50% discount, and then check for validity (the object is already in an invalid state).
source share