# InitializeResourceEvent Constructors

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [InitializeResourceEvent](/reference/api/csharp/aspire.hosting/initializeresourceevent.md)
- Kind: `Constructors`
- Members: `1`

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

## InitializeResourceEvent(IResource, IDistributedApplicationEventing, ResourceLoggerService, ResourceNotificationService, IServiceProvider)

- Name: `Constructor(IResource, IDistributedApplicationEventing, ResourceLoggerService, ResourceNotificationService, IServiceProvider)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/InitializeResourceEvent.cs#L22-L50)

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

```csharp
public class InitializeResourceEvent
{
    public InitializeResourceEvent(
        IResource resource,
        IDistributedApplicationEventing distributedApplicationEventing,
        ResourceLoggerService resourceLoggerService,
        ResourceNotificationService resourceNotificationService,
        IServiceProvider services)
    {
        // ...
    }
}
```

## Parameters

- `resource` ([IResource](/reference/api/csharp/aspire.hosting/iresource.md))
  The resource that is being created.
- `distributedApplicationEventing` ([IDistributedApplicationEventing](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing.md))
  The [IDistributedApplicationEventing](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing.md) service for the app host.
- `resourceLoggerService` ([ResourceLoggerService](/reference/api/csharp/aspire.hosting/resourceloggerservice.md))
  The [ResourceLoggerService](/reference/api/csharp/aspire.hosting/resourceloggerservice.md) for the app host.
- `resourceNotificationService` ([ResourceNotificationService](/reference/api/csharp/aspire.hosting/resourcenotificationservice.md))
  The [ResourceNotificationService](/reference/api/csharp/aspire.hosting/resourcenotificationservice.md) for the app host.
- `services` (`IServiceProvider`)
  The `IServiceProvider` for the app host.

## Remarks

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