-
-
bloudraak
-
215 posts
|
Hello,
Would it be possible to expose events on the Entity that are raised
- before the object graph is being saved
- after the object graph was successfully saved
- when object graph could not be saved as it was cancelled
Here are the scenarios I'm trying to cover:
- I have several entities that each have a corresponding activities table to keep a historical record of what changes were made whom to each record. So in essence, whenever the entity is saved I need to create a new record in the activities window. When I do this by overriding OnSaving method of an entity, then certain logic my not performed by LightSpeed as per this topic. One way I can get around this is to override the OnSaving of the UnitOfWork, but this poses challenges when you have several entities.
- There is also a number of entities that when changes may notify the user of changes. This poses a challenge when one entity sends the notification assuming that it will be persisted, and another throws an exception resulting in nothing being saved. I'd like to send those emails only when the whole graph was persisted.
- My entity manages external resources (such as S3 resources) in its OnSaving method. However, another entity may throw an exception during save. I'd like to cleanup those resources at this point in time.
Thanks,
Werner
|