Domain Events with .NET - New Features
Introduction You may remember my post on the Domain Events framework I created, a few days ago. Well, I've been working on it, cleaning things a bit, correcting a few bugs, and I introduced two new features/concept: Event interceptors can now return a boolean from the BeforePublish event in order to cancel the publication of the event Event transformers Changes to Event Interceptors The changes to the IDomainEventInterceptor / IDomainEventInterceptor<TEvent> interface look like this: public interface IDomainEventInterceptor { ValueTask<bool> BeforePublish(IDomainEvent @event, CancellationToken cancellationToken = default); Task AfterPublish(IDomainEvent @event, CancellationToken cancellationToken = default); } public interface IDomainEventInterceptor<TEvent> where TEvent : IDomainEvent { ValueTask<bool> BeforePublish(TEvent @event, CancellationToken cancellationToken = default); Task AfterPublish(TEvent @event, CancellationToken cancellat...