LifecycleHookServiceCollectionExtensions.TryAddLifecycleHook 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
| TryAddLifecycleHook<T>(IServiceCollection) |
Obsolete.
Attempts to add a distributed application lifecycle hook to the service collection. |
| TryAddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>) |
Obsolete.
Attempts to add a distributed application lifecycle hook to the service collection. |
TryAddLifecycleHook<T>(IServiceCollection)
Caution
Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.
Attempts to add a distributed application lifecycle hook to the service collection.
[System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.")]
public static void TryAddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
public static void TryAddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
[<System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.")>]
static member TryAddLifecycleHook : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'T : null and 'T :> 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.
- Attributes
Applies to
TryAddLifecycleHook<T>(IServiceCollection, Func<IServiceProvider,T>)
Caution
Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.
Attempts to add a distributed application lifecycle hook to the service collection.
[System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.")]
public static void TryAddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
public static void TryAddLifecycleHook<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,T> implementationFactory) where T : class, Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook;
[<System.Obsolete("Use EventingSubscriberServiceCollectionExtensions.TryAddEventingSubscriber instead.")>]
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)
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.
- Attributes