< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.Common.Multitenancy;
 2using Elsa.Features.Services;
 3using Elsa.Features.Abstractions;
 4using Elsa.Connections.Contracts;
 5using Elsa.Connections.Services;
 6using Elsa.Features.Attributes;
 7using Elsa.Secrets.Features;
 8using Microsoft.Extensions.DependencyInjection;
 9using Microsoft.Extensions.DependencyInjection.Extensions;
 10using Microsoft.Extensions.Options;
 11
 12namespace Elsa.Connections.Features;
 13
 14[DependsOn(typeof(SecretsFeature))]
 21215public sealed class ConnectionsFeature(IModule module) : FeatureBase(module)
 16{
 17    public override void Apply()
 18    {
 19        // Lifecycle services always establish an explicit tenant context. Keep a default accessor for
 20        // non-multitenant hosts; TryAdd preserves the accessor supplied by MultitenancyFeature when enabled.
 21221        Services.TryAddSingleton<ITenantAccessor, DefaultTenantAccessor>();
 21222        Services.TryAddSingleton(TimeProvider.System);
 21223        Services.TryAddScoped<IConnectionUseAuthorizer, DenyAllConnectionUseAuthorizer>();
 21224        Services.AddOptions<ConnectionInspectionOptions>();
 25        // Persistence is optional. An inspector without a lifecycle store stays fail-closed.
 21526        Services.TryAddScoped<IConnectionMetadataInspector>(sp => new DefaultConnectionMetadataInspector(
 21527            sp.GetService<IConnectionLifecycleStore>(),
 21528            sp.GetRequiredService<IConnectionUseAuthorizer>(),
 21529            sp.GetRequiredService<ITenantAccessor>(),
 21530            sp.GetRequiredService<IOptions<ConnectionInspectionOptions>>()));
 21231        Services.TryAddScoped<DefaultConnectionLifecycleService>();
 32532        Services.TryAddScoped<IConnectionLifecycleService>(sp => sp.GetRequiredService<DefaultConnectionLifecycleService
 22833        Services.TryAddScoped<IStaticApiKeyLifecycleService>(sp => sp.GetRequiredService<DefaultConnectionLifecycleServi
 21734        Services.TryAddScoped<IConnectionBackgroundUseService>(sp => sp.GetRequiredService<DefaultConnectionLifecycleSer
 24935        Services.TryAddScoped<IConnectionLifecycleRecoveryService>(sp => sp.GetRequiredService<DefaultConnectionLifecycl
 21236    }
 37}