Table of Contents

Class EventHandlerServiceCollectionExtensions

Namespace
CMS.Base
Assembly
CMS.Base.dll

Contains extension methods for registering event handlers into Microsoft.Extensions.DependencyInjection.IServiceCollection.

public static class EventHandlerServiceCollectionExtensions
Inheritance
object
EventHandlerServiceCollectionExtensions

Methods

AddEventHandler<TAsyncEvent, THandler>(IServiceCollection)

Adds an asynchronous event handler to the collection of services.

public static IServiceCollection AddEventHandler<TAsyncEvent, THandler>(this IServiceCollection services) where TAsyncEvent : IAsyncEvent where THandler : class, IAsyncEventHandler<TAsyncEvent>

Parameters

services IServiceCollection

Collection of services to add to.

Returns

IServiceCollection

Returns the services instance to chain further configuration.

Type Parameters

TAsyncEvent

Type of the asynchronous event handled.

THandler

Type implementing the event handler.

Exceptions

ArgumentNullException

Thrown when services is null.