5 implementations of IDistributedApplicationLifecycleHook
Aspire.Hosting.Tests (3)
DistributedApplicationTests.cs (2)
752private sealed class CheckAllocatedEndpointsLifecycleHook(TaskCompletionSource<DistributedApplicationModel> tcs) : IDistributedApplicationLifecycleHook 2398private sealed class KubernetesTestLifecycleHook : IDistributedApplicationLifecycleHook
Publishing\PipelineExecutorTests.cs (1)
61private sealed class CallbackLifecycleHook(Action callback) : IDistributedApplicationLifecycleHook
Aspire.Hosting.TestUtilities (2)
Helpers\CallbackLifecycleHook.cs (1)
9internal sealed class CallbackLifecycleHook : IDistributedApplicationLifecycleHook
Helpers\DummyLifecycleHook.cs (1)
9internal 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)
644var lifecycleHooks = _host.Services.GetServices<IDistributedApplicationLifecycleHook>().ToArray(); 650foreach (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)
21public static void AddLifecycleHook<T>(this IServiceCollection services) where T : class, IDistributedApplicationLifecycleHook 23services.AddSingleton<IDistributedApplicationLifecycleHook, T>(); 33public static void TryAddLifecycleHook<T>(this IServiceCollection services) where T : class, IDistributedApplicationLifecycleHook 35services.TryAddEnumerable(ServiceDescriptor.Singleton<IDistributedApplicationLifecycleHook, T>()); 46public static void AddLifecycleHook<T>(this IServiceCollection services, Func<IServiceProvider, T> implementationFactory) where T : class, IDistributedApplicationLifecycleHook 48services.AddSingleton<IDistributedApplicationLifecycleHook, T>(implementationFactory); 59public static void TryAddLifecycleHook<T>(this IServiceCollection services, Func<IServiceProvider, T> implementationFactory) where T : class, IDistributedApplicationLifecycleHook 61services.TryAddEnumerable(ServiceDescriptor.Singleton<IDistributedApplicationLifecycleHook, T>(implementationFactory));
Orchestrator\ApplicationOrchestrator.cs (3)
27private readonly IDistributedApplicationLifecycleHook[] _lifecycleHooks; 44IEnumerable<IDistributedApplicationLifecycleHook> lifecycleHooks, 641foreach (var lifecycleHook in _lifecycleHooks)
Aspire.Hosting.Tests (3)
DistributedApplicationTests.cs (2)
728var lifecycleHookDescriptors = testProgram.AppBuilder.Services.Where(sd => sd.ServiceType == typeof(IDistributedApplicationLifecycleHook)); 2206var lifecycles = app.Services.GetServices<IDistributedApplicationLifecycleHook>();
Publishing\PipelineExecutorTests.cs (1)
34builder.Services.AddSingleton<IDistributedApplicationLifecycleHook>(new CallbackLifecycleHook(() => lifecycleHookCalled = true));