AfterResourcesCreatedEvent
Class net10.0
This event is published after all resources have been created.
namespace Aspire.Hosting.ApplicationModel;
public class AfterResourcesCreatedEvent : Aspire.Hosting.Eventing.IDistributedApplicationEvent{ // ...}Remarks
Section titled Remarks Subscribing to this event is analogous to implementing the
IDistributedApplicationLifecycleHook.AfterResourcesCreatedAsync method. This event provides access to the IServiceProvider interface to resolve dependencies including DistributedApplicationModel service which is passed in as an argument in IDistributedApplicationLifecycleHook.AfterResourcesCreatedAsync. Constructors1
Section titled ConstructorsProperties2
Section titled PropertiesModelget The
DistributedApplicationModel instance. ServicesgetIServiceProvider The
IServiceProvider instance. Examples
Section titled ExamplesSubscribe to the event and resolve the distributed application model.
var builder = DistributedApplication.CreateBuilder(args);builder.Eventing.Subscribe<AfterResourcesCreatedEvent>(async (@event, cancellationToken) => { var appModel = @event.ServiceProvider.GetRequiredService<DistributedApplicationModel>(); // Run post startup logic.});