Rules in CodeFluent Entities (Video)
Following the same idea as exposed in the Methods post, CodeFluent Entities allows developers to specify rules in their models. Different types of rules are available to us:
- Event rules: triggered upon a lifecycle event of a CodeFluent Entities concept (entity creation, save, delete, read record, property set, etc.),
- Validation rules to validate data inputs,
- Transaction rules: lets you wrap a method in a transaction,
- Implementation rules: specify that an entity implements a particular interface for instance,
- Authorization rules: define permissions in your object model,
- Custom rules: implement your own custom rules.
Here are two videos illustrating different types of rules.
The first one illustrates how to add a Validation rule on a property:
The second one shows how to add an Event rule and how they can be used to extend the generated code by adding your own custom logic: