using Elsa.Features.Services; using Elsa.Workflows.Core.Activities; using Elsa.Workflows.Core.Contracts; using Elsa.Workflows.Management.Features; // ReSharper disable once CheckNamespace namespace Elsa.Extensions; /// /// Provides extensions to the specified / /// public static class ModuleExtensions { /// /// Adds the workflow management feature to the specified module. /// public static IModule UseWorkflowManagement(this IModule module, Action? configure = default) { module.Configure(management => { management.AddActivity(); configure?.Invoke(management); }); return module; } /// /// Adds the default workflow management feature to the specified module. /// public static WorkflowManagementFeature UseWorkflowDefinitions(this WorkflowManagementFeature feature, Action? configure = default) { feature.Module.Configure(configure); return feature; } /// /// Adds the workflow instance feature to workflow management module. /// public static WorkflowManagementFeature UseWorkflowInstances(this WorkflowManagementFeature feature, Action? configure = default) { feature.Module.Configure(configure); return feature; } /// /// Adds the JavaScript integration feature. /// public static WorkflowManagementFeature UseJavaScriptIntegration(this WorkflowManagementFeature feature, Action? configure = default) { feature.Module.Configure(configure); return feature; } /// /// Adds the Elsa DSL integration feature. /// public static WorkflowManagementFeature UseDslIntegration(this WorkflowManagementFeature feature, Action? configure = default) { feature.Module.Configure(configure); return feature; } /// /// Adds all types implementing to the system. /// public static IModule AddActivitiesFrom(this IModule module) => module.UseWorkflowManagement(management => management.AddActivitiesFrom()); /// /// Adds the specified activity type to the system. /// public static IModule AddActivity(this IModule module) where T : IActivity => module.UseWorkflowManagement(management => management.AddActivity()); }