< 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: 74
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.Common.Serialization;
 12using Elsa.Extensions;
 13using Elsa.ShellFeatures;
 14using Elsa.Workflows.Options;
 15using Elsa.Workflows.Runtime.ShellFeatures;
 16using Elsa.Platform.PackageManifest.Generator.Hints;
 17using JetBrains.Annotations;
 18using Microsoft.Extensions.DependencyInjection;
 19
 20namespace Elsa.Alterations.ShellFeatures;
 21
 22/// <summary>
 23/// Adds the Elsa alterations services.
 24/// </summary>
 25[ManifestFeatureCategory("Alterations")]
 26[ManifestFeatureCategory("Workflows")]
 27[ShellFeature(
 28    DisplayName = "Alterations",
 29    Description = "Provides workflow alteration capabilities for modifying running workflow instances",
 30    DependsOn = [typeof(ElsaFastEndpointsFeature), typeof(WorkflowRuntimeFeature)])]
 31[UsedImplicitly]
 32public class AlterationsFeature : IFastEndpointsShellFeature
 33{
 34    /// <summary>
 35    /// Gets or sets the factory for the alteration plan store.
 36    /// </summary>
 037    public Func<IServiceProvider, IAlterationPlanStore> AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredS
 38
 39    /// <summary>
 40    /// Gets or sets the factory for the alteration job store.
 41    /// </summary>
 042    public Func<IServiceProvider, IAlterationJobStore> AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredSer
 43
 44    /// <summary>
 45    /// Gets or sets the factory for the alteration job dispatcher.
 46    /// </summary>
 047    public Func<IServiceProvider, IAlterationJobDispatcher> AlterationJobDispatcherFactory { get; set; } = sp => sp.GetR
 48
 49    public void ConfigureServices(IServiceCollection services)
 50    {
 051        services.Configure<SerializationTypeOptions>(options =>
 052        {
 053            options.RegisterTypeAlias(typeof(AlterationPlanParams), nameof(AlterationPlanParams));
 054            options.RegisterLegacySimpleAssemblyQualifiedName(typeof(AlterationPlanParams));
 055        });
 56
 057        services.AddScoped<IAlterationPlanManager, AlterationPlanManager>();
 058        services.AddAlterations();
 059        services.AddAlterationsCore();
 060        services.AddScoped<BackgroundAlterationJobDispatcher>();
 061        services.AddScoped<IAlterationPlanScheduler, DefaultAlterationPlanScheduler>();
 062        services.AddScoped<IAlterationJobRunner, DefaultAlterationJobRunner>();
 063        services.AddScoped<IAlterationRunner, DefaultAlterationRunner>();
 64
 065        services.AddMemoryStore<AlterationPlan, MemoryAlterationPlanStore>();
 066        services.AddMemoryStore<AlterationJob, MemoryAlterationJobStore>();
 67
 068        services.AddScoped(AlterationPlanStoreFactory);
 069        services.AddScoped(AlterationJobStoreFactory);
 070        services.AddScoped(AlterationJobDispatcherFactory);
 71
 072        services.AddWorkflow<ExecuteAlterationPlanWorkflow>();
 073    }
 74}