< Summary

Information
Class: Elsa.Labels.Features.LabelsFeature
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Features/LabelsFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 54
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
.ctor(...)100%210%
get_LabelStore()100%210%
get_WorkflowDefinitionLabelStore()100%210%
Configure()100%210%
Apply()100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Common.Features;
 2using Elsa.Extensions;
 3using Elsa.Features.Abstractions;
 4using Elsa.Features.Attributes;
 5using Elsa.Features.Services;
 6using Elsa.Labels.Contracts;
 7using Elsa.Labels.Entities;
 8using Elsa.Labels.Services;
 9using Elsa.Workflows.Management;
 10using Microsoft.Extensions.DependencyInjection;
 11
 12namespace Elsa.Labels.Features;
 13
 14/// <summary>
 15/// Enables functionality to tag workflows with labels.
 16/// </summary>
 17[DependsOn(typeof(MediatorFeature))]
 18public class LabelsFeature : FeatureBase
 19{
 20    /// <inheritdoc />
 021    public LabelsFeature(IModule module) : base(module)
 22    {
 023    }
 24
 25    /// <summary>
 26    /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>.
 27    /// </summary>
 028    public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore
 29
 30    /// <summary>
 31    /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>.
 32    /// </summary>
 033    public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G
 34
 35    /// <inheritdoc />
 36    public override void Configure()
 37    {
 038        Module.AddFastEndpointsAssembly(GetType());
 039    }
 40
 41    /// <inheritdoc />
 42    public override void Apply()
 43    {
 044        Services
 045            .AddMemoryStore<Label, InMemoryLabelStore>()
 046            .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>()
 047            .AddScoped(LabelStore)
 048            .AddScoped(WorkflowDefinitionLabelStore)
 049            .AddScoped<IWorkflowDefinitionFilterProvider, WorkflowDefinitionLabelFilterProvider>()
 050            ;
 51
 052        Services.AddNotificationHandlersFrom(GetType());
 053    }
 54}