Enforce validation before persisting model objects
If there are validation rules defined for a (domain model) object, they should be enforced before actually persisting the object. This includes the property validation rules as well as the (custom) validation rules for the whole object.
Later we also need to think of optimizations in this regard, e.g. if a property is not dirty and the object was reconstituted, there's no need to validate it again.
#6 Updated by Karsten Dambekalns almost 10 years ago
- Status changed from Accepted to Needs Feedback
When validating during persistence exceptions thrown cannot be handled any longer, even redirects won't be stopped anymore. Thus it seems better to do the validation when adding to a repository. Any other thoughts?