< Summary

Information
Class: Elsa.Expressions.CSharp.ShellFeatures.CSharpFeature
Assembly: Elsa.Expressions.CSharp
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/ShellFeatures/CSharpFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 53
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_CSharpOptions()100%210%
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/ShellFeatures/CSharpFeature.cs

#LineLine coverage
 1using CShells.Features;
 2using Elsa.Caching.ShellFeatures;
 3using Elsa.Common.ShellFeatures;
 4using Elsa.Expressions.CSharp.Activities;
 5using Elsa.Expressions.CSharp.ActivityDescriptorModifiers;
 6using Elsa.Expressions.CSharp.Contracts;
 7using Elsa.Expressions.CSharp.Options;
 8using Elsa.Expressions.CSharp.Providers;
 9using Elsa.Expressions.CSharp.Services;
 10using Elsa.Expressions.ShellFeatures;
 11using Elsa.Extensions;
 12using Elsa.Workflows;
 13using Elsa.Platform.PackageManifest.Generator.Hints;
 14using JetBrains.Annotations;
 15using Microsoft.Extensions.DependencyInjection;
 16
 17namespace Elsa.Expressions.CSharp.ShellFeatures;
 18
 19/// <summary>
 20/// Installs C# integration.
 21/// </summary>
 22[ManifestFeatureCategory("Expressions")]
 23[ManifestFeatureCategory("Scripting")]
 24[ShellFeature(
 25    DisplayName = "C# Expressions",
 26    Description = "Provides C# expression evaluation capabilities for workflows",
 27    DependsOn = [typeof(MediatorFeature), typeof(ExpressionsFeature), typeof(MemoryCacheFeature)])]
 28[UsedImplicitly]
 29public class CSharpFeature : IShellFeature
 30{
 31    /// <summary>
 32    /// Configures the <see cref="CSharpOptions"/>.
 33    /// </summary>
 034    public Action<CSharpOptions> CSharpOptions { get; set; } = _ => { };
 35
 36    public void ConfigureServices(IServiceCollection services)
 37    {
 038        services.Configure(CSharpOptions);
 39
 40        // C# services.
 041        services
 042            .AddExpressionDescriptorProvider<CSharpExpressionDescriptorProvider>()
 043            .AddScoped<ICSharpEvaluator, CSharpEvaluator>()
 044            .AddSingleton<IActivityDescriptorModifier, CSharpActivityDescriptorModifier>();
 45
 46        // Handlers.
 047        services.AddNotificationHandlersFrom<CSharpFeature>();
 48
 49        // UI property handlers.
 050        services.AddScoped<IPropertyUIHandler, RunCSharpOptionsProvider>();
 051    }
 52}
 53