Skip to content
Docs Try Aspire

LifecycleHookServiceCollectionExtensions Methods

Class Methods 4 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)
{
// ...
}
}
services IServiceCollection The 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)
{
// ...
}
}
services IServiceCollection The service collection to add the hook to.
implementationFactory Func<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)
{
// ...
}
}
services IServiceCollection The 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)
{
// ...
}
}
services IServiceCollection The service collection to add the hook to.
implementationFactory Func<IServiceProvider, T> A factory function that creates the hook implementation.