Entity validation

Automatic and manual validation

Entify provides flexible and extensible validation mechanism for all entity types you define. Entities can be validated manually by calling validation method or you can configure your application's entity context to enforce validation rules automatically on the fly. If you choose to use automatic validation, you can still validate entities manually as needed. If automatic validation is turned on, then the entity context is protected from invalid entities and you can be sure that all the entities in the context are infact valid.

Built-in validators

Entify framework comes with many common validators that can used to validate properites of all entity types. These validation rules are defiend in visual entity editor and requires no coding at all. You can validate properties with the following validators:

  • Null validator
  • Regular expression validator (for string properties)
  • String length validator
  • Range validator for numeric properties
  • Range validator for DateTime properties

Extend validation with custom validators

If your entity type requires more complex and custom validation rules, that's ok too. Implementing a new custom entity validator method to any entity type is straight forward. Created custom validator methods are automatically called by Entify framework, when entity object is given to validation. With custom validator methods you can create, for example, validation rules that depend on more than one property value.

Validation results

Entify framework's validation results are hierarcial and designed in such a way that it's easy to find out all the invalid entities and why they were invalid. On top level there is ValidationResults class which is a simple container for all ValidationResult objects. Each ValidationResult is linked to one entity that had some validation errors. From ValidationResult you can ask which entity failed validation and what where the reasons behind it.

Overview
MonoDevelop add-in
Lovable API
Entity validation
Snapshot
Thread safe
Flexible query mechanism