< Summary

Information
Class: Elsa.Features.ElsaFeature
Assembly: Elsa
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa/Features/ElsaFeature.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 49
Line coverage: 100%
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_DisableAutomaticActivityRegistration()100%11100%
.ctor(...)100%11100%
Configure()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa/Features/ElsaFeature.cs

#LineLine coverage
 1using Elsa.Common.Features;
 2using Elsa.Extensions;
 3using Elsa.Features.Abstractions;
 4using Elsa.Features.Attributes;
 5using Elsa.Features.Services;
 6using Elsa.Workflows.Activities;
 7using Elsa.Workflows.Features;
 8using Elsa.Workflows.Management.Features;
 9using Elsa.Workflows.Runtime.Features;
 10
 11namespace Elsa.Features;
 12
 13/// <summary>
 14/// Represents Elsa as a feature of the system.
 15/// </summary>
 16[DependsOn(typeof(MediatorFeature))]
 17[DependsOn(typeof(WorkflowsFeature))]
 18[DependsOn(typeof(FlowchartFeature))]
 19[DependsOn(typeof(DefaultWorkflowRuntimeFeature))]
 20[DependsOn(typeof(WorkflowManagementFeature))]
 21public class ElsaFeature : FeatureBase
 22{
 23    /// <summary>
 24    /// Set this to true to opt out of automatically registering activities from Elsa.Workflows.Core.
 25    /// </summary>
 126    public bool DisableAutomaticActivityRegistration { get; set; }
 27
 28    /// <inheritdoc />
 129    public ElsaFeature(IModule module) : base(module)
 30    {
 131    }
 32
 33    /// <inheritdoc />
 34    public override void Configure()
 35    {
 136        Module
 137            .UseWorkflows(workflows => workflows
 138                .WithDefaultWorkflowExecutionPipeline()
 139                .WithDefaultActivityExecutionPipeline())
 140            .UseWorkflowManagement(management =>
 141            {
 142                if (!DisableAutomaticActivityRegistration)
 143                    management
 144                        .AddActivitiesFrom<WriteLine>()
 145                        .RemoveActivity<ReadLine>() // ReadLine is not commonly used and can cause "hanging" containers 
 146                        ;
 247            });
 148    }
 49}