onebeyond/onebeyond-studio-core

View on GitHub
src/OneBeyond.Studio.Application.SharedKernel/DomainEvents/IPostSaveDomainEventHandler.cs

Summary

Maintainability
A
0 mins
Test Coverage
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using OneBeyond.Studio.Domain.SharedKernel.DomainEvents;

namespace OneBeyond.Studio.Application.SharedKernel.DomainEvents;

/// <summary>
/// Handles domain events of the <typeparamref name="TDomainEvent"/> type after an entity the event was raised on gets persisted.
/// Handler can be used for implementing side-effects outside of the transaction scope and their result will not affect already persisted entity.
/// For example, a notification can be send from such handler.
/// </summary>
/// <typeparam name="TDomainEvent"></typeparam>
public interface IPostSaveDomainEventHandler<in TDomainEvent>
    where TDomainEvent : DomainEvent
{
    Task HandleAsync(
        TDomainEvent domainEvent,
        IReadOnlyDictionary<string, object> domainEventAmbientContext,
        CancellationToken cancellationToken);
}