Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

[Question] Does Domain Events possible to fail? #8046


User avatar
0
dev.touchpoint created

Hi support team, me and my team having a question about Domain Events.

We are wondering if there is any changes to cause Domain Events fail? For example, the event is not firing when data is already inserted to table.

Thanks, Kenny.


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    I don't think this will happen.

    But you should pay attention to some of the Entity Changes.

    Entity Changes There are also generic event data classes for entity changes: EntityCreatingEventData<TEntity>, EntityCreatedEventData<TEntity>, EntityUpdatingEventData<TEntity>, EntityUpdatedEventData<TEntity>, EntityDeletingEventData<TEntity> and EntityDeletedEventData<TEntity>. Also, there are EntityChangingEventData<TEntity> and EntityChangedEventData<TEntity>. A change can be insert, update or delete.

    'ing' events (e.g. EntityUpdating) are triggered before committing a transaction. This way, you can rollback the unit of work and prevent an operation by throwing an exception. 'ed' events (e.g. EntityUpdated) are triggered after committing a transaction, for which you cannot rollback the unit of work.

    https://aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events#entity-changes

  • User Avatar
    0
    dev.touchpoint created

    Ok thanks for the confirmation.

    If this really happen in the future, we will create a new issue.

    Thanks, Kenny.