Share via


LifecycleHookServiceCollectionExtensions.AddLifecycleHook Method

Definition

Overloads

AddLifecycleHook<T>(IServiceCollection)

Adds a distributed application lifecycle hook to the service collection.

AddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>)

Adds a distributed application lifecycle hook to the service collection.

AddLifecycleHook<T>(IServiceCollection)

Source:
LifecycleHookServiceCollectionExtensions.cs
Source:
LifecycleHookServiceCollectionExtensions.cs

Adds a distributed application lifecycle hook to the service collection.

public static void AddLifecycleHook<T> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, 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.

Applies to

AddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>)

Source:
LifecycleHookServiceCollectionExtensions.cs
Source:
LifecycleHookServiceCollectionExtensions.cs

Adds a distributed application lifecycle hook to the service collection.

public static void AddLifecycleHook<T> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, 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.

Applies to