Share via


LifecycleHookServiceCollectionExtensions.TryAddLifecycleHook Method

Definition

Overloads

TryAddLifecycleHook<T>(IServiceCollection)

Attempts to add a distributed application lifecycle hook to the service collection.

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

Attempts to add a distributed application lifecycle hook to the service collection.

TryAddLifecycleHook<T>(IServiceCollection)

Source:
LifecycleHookServiceCollectionExtensions.cs
Source:
LifecycleHookServiceCollectionExtensions.cs

Attempts to add a distributed application lifecycle hook to the service collection.

public static void TryAddLifecycleHook<T> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
static member TryAddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'T : null and 'T :> Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook)
<Extension()>
Public Sub TryAddLifecycleHook(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

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

Source:
LifecycleHookServiceCollectionExtensions.cs
Source:
LifecycleHookServiceCollectionExtensions.cs

Attempts to add a distributed application lifecycle hook to the service collection.

public static void TryAddLifecycleHook<T> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
static member TryAddLifecycleHook : 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 TryAddLifecycleHook(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