< Summary

Information
Class: Elsa.Http.Extensions.HttpContextTenantExtensions
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Extensions/HttpContextTenantExtensions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 25
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
SetTenantId(...)100%210%
GetTenantId(...)0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Extensions/HttpContextTenantExtensions.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Http;
 2
 3namespace Elsa.Http.Extensions;
 4
 5/// <summary>
 6/// Provides extension methods for the <see cref="HttpContext"/> class.
 7/// </summary>
 8public static class HttpContextTenantExtensions
 9{
 10    /// <summary>
 11    /// Sets the tenant ID for the current HTTP context.
 12    /// </summary>
 13    public static void SetTenantId(this HttpContext httpContext, string? tenantId)
 14    {
 015        httpContext.Items["TenantId"] = tenantId;
 016    }
 17
 18    /// <summary>
 19    /// Gets the tenant ID for the current HTTP context.
 20    /// </summary>
 21    public static string? GetTenantId(this HttpContext httpContext)
 22    {
 023        return httpContext.Items.TryGetValue("TenantId", out var tenantId) ? tenantId as string : null;
 24    }
 25}