Class ResourceHostedService
Background service for initializing cached resources from the localization service at startup.
Inherited Members
Namespace: DataWeb.Localization
Assembly: DataWeb.Core.dll
Syntax
public sealed class ResourceHostedService : IHostedLifecycleService, IHostedService
Remarks
Initializes a new instance of the ResourceHostedService class.
Constructors
ResourceHostedService(IServiceProvider)
Background service for initializing cached resources from the localization service at startup.
Declaration
public ResourceHostedService(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The IServiceProvider instance used for resolving services. |
Remarks
Initializes a new instance of the ResourceHostedService class.
Methods
StartAsync(CancellationToken)
Triggered when the application host is ready to start the service.
Declaration
public Task StartAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Indicates that the start process has been aborted. |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous Start operation. |
StartedAsync(CancellationToken)
Initializes the cached resources after the application has fully started.
Declaration
public Task StartedAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
StartingAsync(CancellationToken)
Triggered before StartAsync(CancellationToken).
Declaration
public Task StartingAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Indicates that the start process has been aborted. |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous operation. |
StopAsync(CancellationToken)
Triggered when the application host is performing a graceful shutdown.
Declaration
public Task StopAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Indicates that the shutdown process should no longer be graceful. |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous Stop operation. |
StoppedAsync(CancellationToken)
Triggered after StopAsync(CancellationToken).
Declaration
public Task StoppedAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Indicates that the stop process has been aborted. |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous operation. |
StoppingAsync(CancellationToken)
Triggered before StopAsync(CancellationToken).
Declaration
public Task StoppingAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Indicates that the start process has been aborted. |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous operation. |