PrimusSaaS.MultiTenancy 1.1.0

dotnet add package PrimusSaaS.MultiTenancy --version 1.1.0
                    
NuGet\Install-Package PrimusSaaS.MultiTenancy -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PrimusSaaS.MultiTenancy" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PrimusSaaS.MultiTenancy" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PrimusSaaS.MultiTenancy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PrimusSaaS.MultiTenancy --version 1.1.0
                    
#r "nuget: PrimusSaaS.MultiTenancy, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PrimusSaaS.MultiTenancy@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PrimusSaaS.MultiTenancy&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PrimusSaaS.MultiTenancy&version=1.1.0
                    
Install as a Cake Tool

PrimusSaaS.MultiTenancy

Release status: stable.

Core package for tenant context, resolution contracts, and multi-tenancy options.

The core runtime and package integrations are validated in the current workspace. Remaining work is ecosystem expansion and broader repo hygiene, not a current code-path release blocker.

Validation

  • Current workspace validation: 242/242 tests passed on net8.0, net9.0, and net10.0
  • Current workspace validation: smoke tests 5/5 passed on net8.0, net9.0, and net10.0
  • Current workspace validation: coverage stayed above the configured threshold on all three frameworks (95.45% line / 87.22% branch on net8.0; 95.38% line / 87.22% branch on net9.0 and net10.0)
  • Scope boundary: core resolution/isolation/runtime only; tenant provisioning and platform workflows stay outside the core package

Telemetry

  • Emits ActivitySource spans for tenant resolution, isolation, propagation, diagnostics, and feature-flag bridge flows.
  • Consumers still need to wire their own exporter if they want those spans collected outside the process.
  • The package intentionally stays exporter-agnostic and does not force a telemetry backend.

For a verified new-app onboarding path that combines Identity Validator + Multi-Tenancy + RBAC in one ASP.NET Core host, use the Docusaurus guide at /docs/modules/combined-dotnet-integration.

Quick start

builder.Services.AddPrimusMultiTenancy(options =>
{
    options.TenantClaimType = "tid";
    options.TenantHeaderName = "X-Tenant-Id";
    options.TenantRouteKey = "tenantId";
    options.EnableSubdomainResolution = false;
    options.RequireTenantOnAuthenticatedRequests = true;
    options.EnableTenantRateLimiting = true;
    options.RateLimitMaxRequests = 100;
    options.RateLimitWindow = TimeSpan.FromMinutes(1);
});

Options reference

Option Type Default Description
TenantClaimType string "tid" Primary JWT claim name read by ClaimsTenantResolutionStrategy
TenantClaimTypes string[] ["tid","tenant_id","tenantId","org_id"] Ordered tenant claim fallbacks checked by ClaimsTenantResolutionStrategy
TenantHeaderName string "X-Tenant-Id" HTTP header name read by HeaderTenantResolutionStrategy
TenantRouteKey string "tenantId" Route parameter name read by RouteTenantResolutionStrategy
EnableSubdomainResolution bool false Activates SubdomainTenantResolutionStrategy (reads HTTP Host header)
RequireTenantOnAuthenticatedRequests bool true Isolation middleware returns 401 when authenticated request has no tenant
EnableTenantRateLimiting bool true Activates per-tenant rate limiting in TenantRateLimitMiddleware
RateLimitMaxRequests int 100 Maximum requests per tenant per window
RateLimitWindow TimeSpan 00:01:00 Rate-limit sliding window duration
SuperAdminClaimType string "primus:role" Claim type checked for tenant bypass
SuperAdminClaimValue string "superadmin" Claim value required to activate bypass
PerTenantRateLimits Dictionary<string, TenantRateLimitPolicy> empty Per-tenant override for max/window

Default resolver precedence

  1. Claims (TenantClaimType)
  2. Header (TenantHeaderName)
  3. Route value (TenantRouteKey)
  4. Subdomain — opt-in via EnableSubdomainResolution
  5. Active membership via ITenantMembershipStore
  • PrimusSaaS.MultiTenancy.AspNetCore — middleware pipeline extensions (UsePrimusTenantResolution, UsePrimusTenantIsolation, UsePrimusTenantRateLimiting)
  • PrimusSaaS.MultiTenancy.EFCore — write interceptor and ModelBuilder schema enforcement
  • PrimusSaaS.MultiTenancy.InMemory — in-memory ITenantMembershipStore for development and tests

New extension points

  • TenantContextSnapshot — preferred unified snapshot API for capturing, transporting, and restoring tenant state across request and background execution scopes.
  • ITenantRateLimiter — plug in a distributed limiter implementation (for example Redis-backed) to enforce tenant limits across instances.
  • ITenantStore helper extensions: SuspendTenantAsync(...), ActivateTenantAsync(...), SoftDeleteTenantAsync(...)
  • ITenantMembershipStore helper extension: GetAccessibleTenantsAsync(...) for tenant switcher scenarios
  • AddPrimusMultiTenancyMembershipCaching(...) — wraps the registered membership store with IMemoryCache.
  • ITenantDataRetentionService — contract for deleting all tenant-owned data during offboarding.
  • ITenantFeatureFlagBridge — default bridge to PrimusSaaS.FeatureFlags that fail-closes when no flag service is registered.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on PrimusSaaS.MultiTenancy:

Package Downloads
PrimusSaaS.MultiTenancy.InMemory

In-memory storage and resolver adapters for PrimusSaaS.MultiTenancy.

PrimusSaaS.Memberships.InMemory

In-memory stores and bridge adapters for PrimusSaaS.Memberships development and test scenarios.

PrimusSaaS.MultiTenancy.AspNetCore

ASP.NET Core middleware and helpers for PrimusSaaS.MultiTenancy.

PrimusSaaS.Identity.Broker.Routing

Optional tenant-aware routing composition add-on for PrimusSaaS.Identity.Broker. Adds generic host-resolution abstractions and middleware without imposing app-specific domain, slug, or provider rules.

PrimusSaaS.Memberships.EFCore

Entity Framework Core integration for PrimusSaaS.Memberships.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 150 4/3/2026
1.0.0 247 3/31/2026