mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 02:11:10 +00:00
Replaces Mediator domain event publishing with a custom implementation and removes the Mediator dependency
This commit is contained in:
1 parent
8c8c96c6db
commit
810fa5c2e7
61 files changed
+618
-176
No files matched your search
@@ -1,5 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Mediator;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
@@ -8,7 +7,7 @@ namespace Lumina.Domain.Common.Events;
|
||||
/// <summary>
|
||||
/// Interface defining a domain event.
|
||||
/// </summary>
|
||||
public interface IDomainEvent : INotification
|
||||
public interface IDomainEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the domain event.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a contract for handling a domain event type in the application layer.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDomainEvent">The type of domain event to handle.</typeparam>
|
||||
public interface IDomainEventHandler<TDomainEvent> where TDomainEvent : IDomainEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles the specified <paramref name="domainEvent"/>.
|
||||
/// </summary>
|
||||
/// <param name="domainEvent">The domain event to handle.</param>
|
||||
/// <param name="cancellationToken">Token to monitor for cancellation requests.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
ValueTask HandleAsync(TDomainEvent domainEvent, CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Publishes domain events to all handlers registered for the event type.
|
||||
/// </summary>
|
||||
public interface IDomainEventPublisher
|
||||
{
|
||||
/// <summary>
|
||||
/// Publishes the specified <paramref name="domainEvent"/> to all its registered handlers, in registration order.
|
||||
/// </summary>
|
||||
/// <param name="domainEvent">The domain event to publish.</param>
|
||||
/// <param name="cancellationToken">Token to monitor for cancellation requests.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
ValueTask PublishAsync(IDomainEvent domainEvent, CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in new issue
Block a user