< Summary

Information
Class: Elsa.Common.ShellHandlers.ActivateShellTenants
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/ShellHandlers/ActivateShellTenants.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 31
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%
InitializeAsync(...)100%210%
DrainAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/ShellHandlers/ActivateShellTenants.cs

#LineLine coverage
 1using CShells.Lifecycle;
 2using Elsa.Common.Multitenancy;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Common.ShellHandlers;
 6
 7/// <summary>
 8/// Activates the shell's tenants when the shell becomes <see cref="ShellLifecycleState.Active"/> and deactivates
 9/// them when the shell enters <see cref="ShellLifecycleState.Draining"/>.
 10/// </summary>
 11/// <remarks>
 12/// Migrated from the pre-0.0.15 CShells lifecycle API
 13/// (<c>IShellActivatedHandler</c>/<c>IShellDeactivatingHandler</c>) to the current
 14/// <see cref="IShellInitializer"/>/<see cref="IDrainHandler"/> primitives. Both register as transient via
 15/// <c>MultitenancyFeature</c>.
 16/// </remarks>
 17[UsedImplicitly]
 018public sealed class ActivateShellTenants(ITenantService tenantService) : IShellInitializer, IDrainHandler
 19{
 20    /// <inheritdoc />
 21    public Task InitializeAsync(CancellationToken cancellationToken = default)
 22    {
 023        return tenantService.ActivateTenantsAsync(cancellationToken);
 24    }
 25
 26    /// <inheritdoc />
 27    public Task DrainAsync(IDrainExtensionHandle extensionHandle, CancellationToken cancellationToken)
 28    {
 029        return tenantService.DeactivateTenantsAsync(cancellationToken);
 30    }
 31}