Skip to content
Docs Try Aspire

EventingSubscriberServiceCollectionExtensions Methods

Class Methods 2 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)
{
// ...
}
}
services IServiceCollection The 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)
{
// ...
}
}
services IServiceCollection The DependencyInjection.IServiceCollection to add the event subscriber to.