2022-12-31 15:16:43 +00:00
|
|
|
using Elsa.Features.Services;
|
2023-01-04 19:36:38 +00:00
|
|
|
using Elsa.Workflows.Core.Services;
|
2022-12-31 15:16:43 +00:00
|
|
|
using Elsa.Workflows.Runtime.Features;
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
namespace Elsa.Extensions;
|
|
|
|
|
|
2023-01-02 21:24:05 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Adds extensions to setup the <see cref="WorkflowRuntimeFeature"/> feature.
|
|
|
|
|
/// </summary>
|
2022-12-31 15:16:43 +00:00
|
|
|
public static class ModuleExtensions
|
|
|
|
|
{
|
2023-01-02 21:24:05 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Enables the <see cref="WorkflowRuntimeFeature"/> feature.
|
|
|
|
|
/// </summary>
|
2022-12-31 15:16:43 +00:00
|
|
|
public static IModule UseWorkflowRuntime(this IModule module, Action<WorkflowRuntimeFeature>? configure = default)
|
|
|
|
|
{
|
|
|
|
|
module.Configure(configure);
|
|
|
|
|
return module;
|
|
|
|
|
}
|
2023-01-04 19:36:38 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Register the specified workflow type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IModule AddWorkflow<T>(this IModule module) where T : IWorkflow
|
|
|
|
|
{
|
|
|
|
|
module.Configure<WorkflowRuntimeFeature>().AddWorkflow<T>();
|
|
|
|
|
return module;
|
|
|
|
|
}
|
2023-01-05 14:10:55 +00:00
|
|
|
|
|
|
|
|
public static WorkflowRuntimeFeature UseDefaultRuntime(this WorkflowRuntimeFeature feature, Action<DefaultRuntimeFeature>? configure = default)
|
|
|
|
|
{
|
|
|
|
|
feature.Module.Configure(configure);
|
|
|
|
|
return feature;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static WorkflowRuntimeFeature UseExecutionLogRecords(this WorkflowRuntimeFeature feature, Action<ExecutionLogRecordFeature>? configure = default)
|
|
|
|
|
{
|
|
|
|
|
feature.Module.Configure(configure);
|
|
|
|
|
return feature;
|
|
|
|
|
}
|
2023-01-13 19:10:05 +00:00
|
|
|
|
|
|
|
|
public static WorkflowRuntimeFeature UseAsyncWorkflowStateExporter(this WorkflowRuntimeFeature feature, Action<AsyncWorkflowStateExporterFeature>? configure = default)
|
|
|
|
|
{
|
|
|
|
|
feature.Module.Configure(configure);
|
|
|
|
|
return feature;
|
|
|
|
|
}
|
2022-12-31 15:16:43 +00:00
|
|
|
}
|