5 implementations of IDistributedApplicationLifecycleHook
Aspire.Hosting.Tests (3)
DistributedApplicationTests.cs (2)
752
private sealed class CheckAllocatedEndpointsLifecycleHook(TaskCompletionSource<DistributedApplicationModel> tcs) :
IDistributedApplicationLifecycleHook
2398
private sealed class KubernetesTestLifecycleHook :
IDistributedApplicationLifecycleHook
Publishing\PipelineExecutorTests.cs (1)
61
private sealed class CallbackLifecycleHook(Action callback) :
IDistributedApplicationLifecycleHook
Aspire.Hosting.TestUtilities (2)
Helpers\CallbackLifecycleHook.cs (1)
9
internal sealed class CallbackLifecycleHook :
IDistributedApplicationLifecycleHook
Helpers\DummyLifecycleHook.cs (1)
9
internal sealed class DummyLifecycleHook :
IDistributedApplicationLifecycleHook
23 references to IDistributedApplicationLifecycleHook
Aspire.Hosting (20)
ApplicationModel\AfterEndpointsAllocatedEvent.cs (2)
14
/// Subscribing to this event is analogous to implementing the <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.AfterEndpointsAllocatedAsync(DistributedApplicationModel, CancellationToken)"/>
17
/// in <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.AfterEndpointsAllocatedAsync(Aspire.Hosting.ApplicationModel.DistributedApplicationModel, CancellationToken)"/>.
ApplicationModel\AfterResourcesCreatedEvent.cs (2)
14
/// Subscribing to this event is analogous to implementing the <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.AfterResourcesCreatedAsync(DistributedApplicationModel, CancellationToken)"/>
17
/// in <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.AfterResourcesCreatedAsync(Aspire.Hosting.ApplicationModel.DistributedApplicationModel, CancellationToken)"/>.
ApplicationModel\BeforeStartEvent.cs (2)
14
/// Subscribing to this event is analogous to implementing the <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.BeforeStartAsync(Aspire.Hosting.ApplicationModel.DistributedApplicationModel, CancellationToken)"/>
17
/// in <see cref="Aspire.Hosting.Lifecycle.
IDistributedApplicationLifecycleHook
.BeforeStartAsync(Aspire.Hosting.ApplicationModel.DistributedApplicationModel, CancellationToken)"/>.
DistributedApplication.cs (2)
644
var lifecycleHooks = _host.Services.GetServices<
IDistributedApplicationLifecycleHook
>().ToArray();
650
foreach (
var
lifecycleHook in lifecycleHooks)
IDistributedApplicationBuilder.cs (1)
229
/// collection. Not all changes to annotations will be effective depending on what stage of the lifecycle the app host is in. See <see cref="
IDistributedApplicationLifecycleHook
"/>
Lifecycle\LifecycleHookServiceCollectionExtensions.cs (8)
21
public static void AddLifecycleHook<T>(this IServiceCollection services) where T : class,
IDistributedApplicationLifecycleHook
23
services.AddSingleton<
IDistributedApplicationLifecycleHook
, T>();
33
public static void TryAddLifecycleHook<T>(this IServiceCollection services) where T : class,
IDistributedApplicationLifecycleHook
35
services.TryAddEnumerable(ServiceDescriptor.Singleton<
IDistributedApplicationLifecycleHook
, T>());
46
public static void AddLifecycleHook<T>(this IServiceCollection services, Func<IServiceProvider, T> implementationFactory) where T : class,
IDistributedApplicationLifecycleHook
48
services.AddSingleton<
IDistributedApplicationLifecycleHook
, T>(implementationFactory);
59
public static void TryAddLifecycleHook<T>(this IServiceCollection services, Func<IServiceProvider, T> implementationFactory) where T : class,
IDistributedApplicationLifecycleHook
61
services.TryAddEnumerable(ServiceDescriptor.Singleton<
IDistributedApplicationLifecycleHook
, T>(implementationFactory));
Orchestrator\ApplicationOrchestrator.cs (3)
27
private readonly
IDistributedApplicationLifecycleHook
[] _lifecycleHooks;
44
IEnumerable<
IDistributedApplicationLifecycleHook
> lifecycleHooks,
641
foreach (
var
lifecycleHook in _lifecycleHooks)
Aspire.Hosting.Tests (3)
DistributedApplicationTests.cs (2)
728
var lifecycleHookDescriptors = testProgram.AppBuilder.Services.Where(sd => sd.ServiceType == typeof(
IDistributedApplicationLifecycleHook
));
2206
var lifecycles = app.Services.GetServices<
IDistributedApplicationLifecycleHook
>();
Publishing\PipelineExecutorTests.cs (1)
34
builder.Services.AddSingleton<
IDistributedApplicationLifecycleHook
>(new CallbackLifecycleHook(() => lifecycleHookCalled = true));