Skip to content

Search EricksonLopez.* Ecosystem

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

EricksonLopez.MultiTenancy Overview

EricksonLopez.MultiTenancy (2.0.0 on NuGet, L2) enforces tenant boundary propagation from HTTP resolution (TenantResolutionMiddleware) down to database row-level security (PostgreSQL SET LOCAL, SQL Server SESSION_CONTEXT, MySQL/MariaDB session variables, and Dapper parameter binding).

  • Immutable TenantId (ISpanParsable<TenantId>): Zero-allocation span parsing, UUIDv7 NewId(), and Result<TenantId> validation (TenantId.From(...)).
  • Fail-closed database isolation: PostgreSqlRlsExtensions (BeginTenantTransactionAsync, SetTenantRlsContextAsync) binds tenant context to transaction-scoped SET LOCAL, while Roslyn analyzers (ELMT001–ELMT004) flag Dapper queries missing tenant predicates or superuser connection strings.
  • Explicit authentication binding: ValidateAuthenticatedPrincipalTenantClaim (true by default) rejects spoofed headers/routes that conflict with authenticated "tenant_id" claims.
  • Accurate package scope: 15 of 16 packages are published (2.0.0); EricksonLopez.MultiTenancy.Caching is unpublished (3.1.0 local only), and EntityFrameworkCore was removed in v1.0.0 (BC-106).
flowchart LR
HTTP["HTTP Request"] --> MW["TenantResolutionMiddleware (8 Strategies)"]
MW --> Ctx["ITenantContext / ScopedTenantContextAccessor"]
Ctx --> DB["PostgreSQL SET LOCAL / Dapper WithTenant"]
Ctx -- Unresolved & RequireTenant --> Err["TenantErrors.Unresolved / 400-403"]
Multi-Tenant Request and Database Isolation PipelineTenantResolutionMiddleware resolves TenantId from host, route, header, or claim, populates ITenantContext, and propagates it into PostgreSQL RLS or Dapper parameterized queries.
View accessible text summary and structure

TenantResolutionMiddleware resolves TenantId from host, route, header, or claim, populates ITenantContext, and propagates it into PostgreSQL RLS or Dapper parameterized queries.

flowchart LR
HTTP["HTTP Request"] --> MW["TenantResolutionMiddleware (8 Strategies)"]
MW --> Ctx["ITenantContext / ScopedTenantContextAccessor"]
Ctx --> DB["PostgreSQL SET LOCAL / Dapper WithTenant"]
Ctx -- Unresolved & RequireTenant --> Err["TenantErrors.Unresolved / 400-403"]

Overall AOT status is Partial (13 Full, 2 Incompatible, 1 NotApplicable). Note that EricksonLopez.MultiTenancy.Dapper is Full AOT, whereas Oracle and SqlServer are Incompatible:

Package NuGet (2.0.0) AOT Status TFMs Role
EricksonLopez.MultiTenancy Published (347 dl) Full net8.0;net9.0;net10.0 ScopedTenantContextAccessor, DefaultTenantScopeFactory, InMemoryTenantStore<T>, CachedTenantStore<T>
EricksonLopez.MultiTenancy.Abstractions Published (675 dl) Full net8.0;net9.0;net10.0 TenantId, TenantInfo, ITenantContext, TenantErrors, IOrganizationContext
EricksonLopez.MultiTenancy.AspNetCore Published (308 dl) Full net8.0;net9.0;net10.0 TenantResolutionMiddleware, 8 strategies, RequireTenant(), AllowAnonymousTenant()
EricksonLopez.MultiTenancy.Authentication Published (286 dl) Full net8.0;net9.0;net10.0 AddPerTenantAuthentication<TTenant>, TenantCookieAuthenticationEvents<TTenant>
EricksonLopez.MultiTenancy.Configuration Published (301 dl) Full net8.0;net9.0;net10.0 ConfigurationTenantStore<TTenant>
EricksonLopez.MultiTenancy.Dapper Published (285 dl) Full net8.0;net9.0;net10.0 WithTenant, CreateTenantParameters (Full AOT)
EricksonLopez.MultiTenancy.PostgreSql Published (285 dl) Full net8.0;net9.0;net10.0 BeginTenantTransactionAsync, SetTenantRlsContextAsync, PostgreSqlTenantStore
EricksonLopez.MultiTenancy.MariaDb / .MySql / .Sqlite Published (280/267/286 dl) Full net8.0;net9.0;net10.0 Dialect session variables and connection factories
EricksonLopez.MultiTenancy.OpenTelemetry / .Testing Published (267/277 dl) Full net8.0;net9.0;net10.0 TenantActivitySource, TenantMetrics, FakeTenantStore, TestTenantContext
EricksonLopez.MultiTenancy.Oracle / .SqlServer Published (282/284 dl) Incompatible net8.0;net9.0;net10.0 IsAotCompatible=false, EnableTrimAnalyzer=false (Oracle.ManagedDataAccess.Core / Microsoft.Data.SqlClient)
EricksonLopez.MultiTenancy.Analyzers Published (255 dl) NotApplicable netstandard2.0 Roslyn rules ELMT001–ELMT004
EricksonLopez.MultiTenancy.Caching Unpublished Full net8.0;net9.0;net10.0 Local workspace 3.1.0 only (TenantDistributedCacheDecorator)

Benchmark Status: hasBenchmarks: false — no BenchmarkDotNet reports are published for dotnet-multitenancy.