Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Configuration & Integrations — MultiTenancy

L2StableNuGet: v2.0.0Local HEAD: v3.1.0AOT: Partial

Configure HTTP tenant resolution middleware, per-tenant authentication cookies, and database session isolation.

TenantResolutionMiddlewareOptions (in EricksonLopez.MultiTenancy.AspNetCore.Options) exposes:

  • RequireTenant (default false) — enforce tenant presence globally, or per-endpoint with .RequireTenant() / .AllowAnonymousTenant().
  • FailOnStoreMiss (default true) — reject unknown tenant IDs instead of continuing anonymously.
  • WriteProblemDetailsOnConflict (default false) — emit RFC 9457 ProblemDetails on claim vs strategy mismatch.
  • ValidateAuthenticatedPrincipalTenantClaim (default true, TenantClaimType = "tenant_id") — prevent cross-tenant spoofing after authentication.
  • PostgreSQL: connection.BeginTenantTransactionAsync(...) and connection.SetTenantRlsContextAsync(DbTransaction, ITenantContext, sessionVariable = "app.current_tenant_id").
  • SQL Server (BC-003): connection.SetTenantSessionContextAsync(DbTransaction transaction, ITenantContext tenantContext, string sessionKey = "TenantId", bool readOnly = false) (transaction is the mandatory 2nd parameter in v2.0.0).
  • Dapper: parameters.WithTenant(tenantContext) and tenantContext.CreateTenantParameters(...).
  • Authentication & OpenTelemetry: AddPerTenantAuthentication<TTenant>() and TenantActivitySource / TenantMetrics / TenantTraceEnricher.

Unpublished & Removed Notes: EricksonLopez.MultiTenancy.Caching (AddTenantDistributedCache()) is local-only (3.1.0, unpublished on NuGet). EricksonLopez.MultiTenancy.EntityFrameworkCore was removed in v1.0.0 (BC-106).