Skip to content
DocsTry Aspire
DocsTry

LifecycleHookServiceCollectionExtensions Methods

ClassMethods4 members
Provides extension methods for adding lifecycle hooks to the DependencyInjection.IServiceCollection.
AddLifecycleHook(IServiceCollection)Section titled AddLifecycleHook(IServiceCollection)extension
Adds a distributed application lifecycle hook to the service collection.
public static class LifecycleHookServiceCollectionExtensions
{
public static void AddLifecycleHook<T>(
this IServiceCollection services)
{
// ...
}
}
servicesIServiceCollectionThe DependencyInjection.IServiceCollection to add the distributed application lifecycle hook to.
AddLifecycleHook(IServiceCollection, Func<IServiceProvider, T>)Section titled AddLifecycleHook(IServiceCollection, Func<IServiceProvider, T>)extension
Adds a distributed application lifecycle hook to the service collection.
public static class LifecycleHookServiceCollectionExtensions
{
public static void AddLifecycleHook<T>(
this IServiceCollection services,
Func<IServiceProvider, T> implementationFactory)
{
// ...
}
}
servicesIServiceCollectionThe service collection to add the hook to.
implementationFactoryFunc<IServiceProvider, T>A factory function that creates the hook implementation.
TryAddLifecycleHook(IServiceCollection)Section titled TryAddLifecycleHook(IServiceCollection)extension
Attempts to add a distributed application lifecycle hook to the service collection.
public static class LifecycleHookServiceCollectionExtensions
{
public static void TryAddLifecycleHook<T>(
this IServiceCollection services)
{
// ...
}
}
servicesIServiceCollectionThe DependencyInjection.IServiceCollection to add the distributed application lifecycle hook to.
TryAddLifecycleHook(IServiceCollection, Func<IServiceProvider, T>)Section titled TryAddLifecycleHook(IServiceCollection, Func<IServiceProvider, T>)extension
Attempts to add a distributed application lifecycle hook to the service collection.
public static class LifecycleHookServiceCollectionExtensions
{
public static void TryAddLifecycleHook<T>(
this IServiceCollection services,
Func<IServiceProvider, T> implementationFactory)
{
// ...
}
}
servicesIServiceCollectionThe service collection to add the hook to.
implementationFactoryFunc<IServiceProvider, T>A factory function that creates the hook implementation.