LifecycleHookServiceCollectionExtensions.AddLifecycleHook Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| AddLifecycleHook<T>(IServiceCollection) |
Obsolete.
Adds a distributed application lifecycle hook to the service collection. |
| AddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>) |
Obsolete.
Adds a distributed application lifecycle hook to the service collection. |
AddLifecycleHook<T>(IServiceCollection)
Caution
Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.
Adds a distributed application lifecycle hook to the service collection.
[System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.")]
public static void AddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
public static void AddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
[<System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.")>]
static member AddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)
static member AddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)
<Extension()>
Public Sub AddLifecycleHook(Of T As {Class, IDistributedApplicationLifecycleHook}) (services As IServiceCollection)
Type Parameters
- T
The type of the distributed application lifecycle hook to add.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the distributed application lifecycle hook to.
- Attributes
Applies to
AddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>)
Caution
Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.
Adds a distributed application lifecycle hook to the service collection.
[System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.")]
public static void AddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
public static void AddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
[<System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.AddEventingSubscriber instead.")>]
static member AddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'T (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)> -> unit (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)
static member AddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'T (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)> -> unit (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)
<Extension()>
Public Sub AddLifecycleHook(Of T As {Class, IDistributedApplicationLifecycleHook}) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, T))
Type Parameters
- T
The type of the distributed application lifecycle hook.
Parameters
- services
- IServiceCollection
The service collection to add the hook to.
- implementationFactory
- Func<IServiceProvider,T>
A factory function that creates the hook implementation.
- Attributes