Class EventHandlerServiceCollectionExtensions
Contains extension methods for registering event handlers into Microsoft.Extensions.DependencyInjection.IServiceCollection.
public static class EventHandlerServiceCollectionExtensions
- Inheritance
-
objectEventHandlerServiceCollectionExtensions
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
servicesIServiceCollectionCollection of services to add to.
Returns
- IServiceCollection
Returns the
servicesinstance to chain further configuration.
Type Parameters
TAsyncEventType of the asynchronous event handled.
THandlerType implementing the event handler.
Exceptions
- ArgumentNullException
Thrown when
servicesis null.