Class InitializationPipelineService
Orchestrates the execution of a series of initialization tasks, respecting their criticality and weight.
Inherited Members
Namespace: Serenity.InitializationPipeline.Application.Services
Assembly: Serenity.InitializationPipeline.Application.dll
Syntax
public class InitializationPipelineService : IService, IFoundationSettings
Constructors
InitializationPipelineService(IEnumerable<ITask>, ISkipPolicy, IInitializationPipelineTelemetry, ILogService)
Initializes the pipeline with the provided tasks, skip policy, and optional telemetry.
Declaration
public InitializationPipelineService(IEnumerable<ITask> tasks, ISkipPolicy skipPolicy, IInitializationPipelineTelemetry telemetry, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITask> | tasks | Collection of initialization tasks to execute |
| ISkipPolicy | skipPolicy | Policy to determine if certain tasks can be skipped |
| IInitializationPipelineTelemetry | telemetry | Optional telemetry interface for monitoring progress |
| ILogService | logService |
Remarks
Tasks with non-positive weight will default to a weight of 1.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if tasks or skipPolicy is null |
Properties
Guid
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
| Type | Description |
|---|---|
| ILogService |
Methods
BuildPlan()
Builds a plan representing the sequence and characteristics of the tasks to be executed.
Declaration
public IReadOnlyList<InitializationPipelineStep> BuildPlan()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<InitializationPipelineStep> | A read-only list of initialization pipeline steps. |
RunAsync(CancellationToken)
Executes the initialization pipeline asynchronously, respecting task criticality and skip policy.
Declaration
public Task<bool> RunAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Cancellation token to cancel the operation |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if all critical tasks completed successfully; otherwise, false. |
Remarks
Non-critical task failures do not halt the pipeline execution.
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | Thrown if the operation is canceled via the cancellation token. |