# InitializeResourceEvent

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/InitializeResourceEvent.cs)
- Implements: [IDistributedApplicationEvent](/reference/api/csharp/aspire.hosting/idistributedapplicationevent.md), [IDistributedApplicationResourceEvent](/reference/api/csharp/aspire.hosting/idistributedapplicationresourceevent.md)

This event is raised by orchestrators to signal to resources that they should initialize themselves.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class InitializeResourceEvent
    : Aspire.Hosting.Eventing.IDistributedApplicationEvent,
      Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting/InitializeResourceEvent`
- Public instance properties are exported as ATS capabilities.

## Remarks

Custom resources can subscribe to this event to perform initialization tasks, including starting background tasks that manage the resource's lifecycle.

## Constructors

- [InitializeResourceEvent(IResource, IDistributedApplicationEventing, ResourceLoggerService, ResourceNotificationService, IServiceProvider)](/reference/api/csharp/aspire.hosting/initializeresourceevent/constructors.md#constructor-iresource-idistributedapplicationeventing-resourceloggerservice-resourcenotificationservice-iserviceprovider) -- This event is raised by orchestrators to signal to resources that they should initialize themselves.

## Properties

- [Eventing](/reference/api/csharp/aspire.hosting/initializeresourceevent/properties.md#eventing) : [IDistributedApplicationEventing](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing.md) `get` -- The [IDistributedApplicationEventing](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing.md) service for the app host.
- [Logger](/reference/api/csharp/aspire.hosting/initializeresourceevent/properties.md#logger) : `ILogger` `get` -- An instance of `Logging.ILogger` that can be used to log messages for the resource.
- [Notifications](/reference/api/csharp/aspire.hosting/initializeresourceevent/properties.md#notifications) : [ResourceNotificationService](/reference/api/csharp/aspire.hosting/resourcenotificationservice.md) `get` -- The [ResourceNotificationService](/reference/api/csharp/aspire.hosting/resourcenotificationservice.md) for the app host.
- [Resource](/reference/api/csharp/aspire.hosting/initializeresourceevent/properties.md#resource) : [IResource](/reference/api/csharp/aspire.hosting/iresource.md) `get` -- Resource associated with this event.
- [Services](/reference/api/csharp/aspire.hosting/initializeresourceevent/properties.md#services) : `IServiceProvider` `get` -- The `IServiceProvider` for the app host.
