Saving
This event is triggered on the server before saving. The rule is cancelable in order to be able to prevent entities from being saved. You can use this event to update the properties of entities before they are saved.
Note
Entity validation rules that prevent invalid data to be saved are triggered after this rule.
If needed, you can inject other entity repositories in the event rule constructor to be able to add, modify or remove elements from them. Changes made in them will also be saved.
Note
When the save fails (error, validation rule, ...), changes made in the other repositories are not saved.
Arguments
You can find the details of the interface on this page
Name | Type | Description |
---|---|---|
CreatedItems |
IReadOnlyList<TEntity> |
The created items. |
ModifiedItems |
IReadOnlyList<TEntity> |
The modified items. |
CreatedAndModifiedItems |
IReadOnlyList<TEntity> |
The created and modified items regrouped in the same collection. |
DeletedItems |
IReadOnlyList<TEntity> |
The deleted items. |
Context |
IBusinessRuleContext |
Represents a key/value pair dictionary that is used to store custom data. You can find the details of the interface on this page |
Cancel |
boolean |
If set to true , the save will not be executed. |