Skip to content
DocsTry Aspire
DocsTry

EventingSubscriberServiceCollectionExtensions Methods

ClassMethods2 members
Provides extension methods for adding event subscribers to the DependencyInjection.IServiceCollection.
AddEventingSubscriber(IServiceCollection)Section titled AddEventingSubscriber(IServiceCollection)extension
Adds a singleton event subscriber of type T to the service collection.
public static class EventingSubscriberServiceCollectionExtensions
{
public static void AddEventingSubscriber<T>(
this IServiceCollection services)
{
// ...
}
}
servicesIServiceCollectionThe DependencyInjection.IServiceCollection to add the event subscriber to.
TryAddEventingSubscriber(IServiceCollection)Section titled TryAddEventingSubscriber(IServiceCollection)extension
Attempts to add a singleton event subscriber of type T to the service collection.
public static class EventingSubscriberServiceCollectionExtensions
{
public static void TryAddEventingSubscriber<T>(
this IServiceCollection services)
{
// ...
}
}
servicesIServiceCollectionThe DependencyInjection.IServiceCollection to add the event subscriber to.