Interface IAsyncEventHandler<TAsyncEvent>
Represents a handler for asynchronous events.
public interface IAsyncEventHandler<in TAsyncEvent> where TAsyncEvent : IAsyncEvent
Type Parameters
TAsyncEventType of the asynchronous event handled. This type parameter is contravariant.
- Extension Methods
Remarks
A singleton handler instance is used for all event occurrences.
If the event is a compound event with state (implements the IEventState interface), the implementing handler can store data between the associated event handling stages using the EventStateStore members (such as between associated before and after event handlers).
Methods
HandleAsync(TAsyncEvent, CancellationToken)
Executes custom actions when the event is invoked.
Task HandleAsync(TAsyncEvent asyncEvent, CancellationToken cancellationToken)
Parameters
asyncEventTAsyncEventAsynchronous event which caused the handling to be invoked.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task
Returns a task representing the asynchronous event handling operation.
See Also
AddEventHandler<TAsyncEvent, THandler>(IServiceCollection)