What is the difference between Invariants and Validation Rules?

后端 未结 2 824
面向向阳花
面向向阳花 2021-02-01 19:53

I often see the term Invariants in DDD. Here Dino Esposito talks about it. If I look at the .NET library, I see a ValidationAttribute class. Are Invaria

2条回答
  •  轮回少年
    2021-02-01 20:49

    Yes, I think so

    In DDD, validation rules can be thought as invariants. The main responsibility of an aggregate is to enforce invariants across state changes for all the entities within that aggregate.

    You can refer more info in this page

提交回复
热议问题