Table of Contents

Interface IAsyncEventHandler<TAsyncEvent>

Namespace
CMS.Base
Assembly
CMS.Base.dll

Represents a handler for asynchronous events.

public interface IAsyncEventHandler<in TAsyncEvent> where TAsyncEvent : IAsyncEvent

Type Parameters

TAsyncEvent

Type 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

asyncEvent TAsyncEvent

Asynchronous event which caused the handling to be invoked.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task

Returns a task representing the asynchronous event handling operation.

See Also

IAsyncEvent
AddEventHandler<TAsyncEvent, THandler>(IServiceCollection)