< Summary

Information
Class: Elsa.Alterations.ShellFeatures.AlterationsFeature
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/ShellFeatures/AlterationsFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 69
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_AlterationPlanStoreFactory()100%210%
get_AlterationJobStoreFactory()100%210%
get_AlterationJobDispatcherFactory()100%210%
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/ShellFeatures/AlterationsFeature.cs

#LineLine coverage
 1using CShells.FastEndpoints.Features;
 2using CShells.Features;
 3using Elsa.Alterations.Core.Contracts;
 4using Elsa.Alterations.Core.Entities;
 5using Elsa.Alterations.Core.Extensions;
 6using Elsa.Alterations.Core.Models;
 7using Elsa.Alterations.Core.Stores;
 8using Elsa.Alterations.Extensions;
 9using Elsa.Alterations.Services;
 10using Elsa.Alterations.Workflows;
 11using Elsa.Extensions;
 12using Elsa.Workflows.Options;
 13using JetBrains.Annotations;
 14using Microsoft.Extensions.DependencyInjection;
 15using Elsa.Common.Serialization;
 16
 17namespace Elsa.Alterations.ShellFeatures;
 18
 19/// <summary>
 20/// Adds the Elsa alterations services.
 21/// </summary>
 22[ShellFeature(
 23    DisplayName = "Alterations",
 24    Description = "Provides workflow alteration capabilities for modifying running workflow instances",
 25    DependsOn = ["ElsaFastEndpoints", "WorkflowRuntime"])]
 26[UsedImplicitly]
 27public class AlterationsFeature : IFastEndpointsShellFeature
 28{
 29    /// <summary>
 30    /// Gets or sets the factory for the alteration plan store.
 31    /// </summary>
 032    public Func<IServiceProvider, IAlterationPlanStore> AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredS
 33
 34    /// <summary>
 35    /// Gets or sets the factory for the alteration job store.
 36    /// </summary>
 037    public Func<IServiceProvider, IAlterationJobStore> AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredSer
 38
 39    /// <summary>
 40    /// Gets or sets the factory for the alteration job dispatcher.
 41    /// </summary>
 042    public Func<IServiceProvider, IAlterationJobDispatcher> AlterationJobDispatcherFactory { get; set; } = sp => sp.GetR
 43
 44    public void ConfigureServices(IServiceCollection services)
 45    {
 046        services.Configure<SerializationTypeOptions>(options =>
 047        {
 048            options.RegisterTypeAlias(typeof(AlterationPlanParams), nameof(AlterationPlanParams));
 049            options.RegisterLegacySimpleAssemblyQualifiedName(typeof(AlterationPlanParams));
 050        });
 51
 052        services.AddScoped<IAlterationPlanManager, AlterationPlanManager>();
 053        services.AddAlterations();
 054        services.AddAlterationsCore();
 055        services.AddScoped<BackgroundAlterationJobDispatcher>();
 056        services.AddScoped<IAlterationPlanScheduler, DefaultAlterationPlanScheduler>();
 057        services.AddScoped<IAlterationJobRunner, DefaultAlterationJobRunner>();
 058        services.AddScoped<IAlterationRunner, DefaultAlterationRunner>();
 59
 060        services.AddMemoryStore<AlterationPlan, MemoryAlterationPlanStore>();
 061        services.AddMemoryStore<AlterationJob, MemoryAlterationJobStore>();
 62
 063        services.AddScoped(AlterationPlanStoreFactory);
 064        services.AddScoped(AlterationJobStoreFactory);
 065        services.AddScoped(AlterationJobDispatcherFactory);
 66
 067        services.AddWorkflow<ExecuteAlterationPlanWorkflow>();
 068    }
 69}