PrimusSaaS.MultiTenancy.AspNetCore 1.1.0

dotnet add package PrimusSaaS.MultiTenancy.AspNetCore --version 1.1.0
                    
NuGet\Install-Package PrimusSaaS.MultiTenancy.AspNetCore -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.AspNetCore" 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.AspNetCore" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PrimusSaaS.MultiTenancy.AspNetCore" />
                    
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.AspNetCore --version 1.1.0
                    
#r "nuget: PrimusSaaS.MultiTenancy.AspNetCore, 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.AspNetCore@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.AspNetCore&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PrimusSaaS.MultiTenancy.AspNetCore&version=1.1.0
                    
Install as a Cake Tool

PrimusSaaS.MultiTenancy.AspNetCore

Release status: stable integration package for PrimusSaaS.MultiTenancy.

ASP.NET Core integration package for Primus multi-tenancy.

Validation

  • Current workspace validation: covered by the PrimusSaaS.MultiTenancy.Tests suite, which passed 242/242 on net8.0, net9.0, and net10.0, plus smoke tests 5/5
  • Scope boundary: middleware and endpoint extensions only; tenant registry and provisioning remain outside the generic core
  • For a first-time onboarding path that combines Identity Validator, Multi-Tenancy, and RBAC in one host, use /docs/modules/combined-dotnet-integration

Usage

builder.Services
	.AddPrimusMultiTenancy()
	.AddPrimusMultiTenancyAspNetCore();

app.UseAuthentication();
app.UsePrimusTenantResolution();
app.UsePrimusTenantIsolation();
app.UsePrimusTenantRateLimiting();
app.UsePrimusTenantEntitlements();
app.UseAuthorization();

UsePrimusTenantIsolation() returns 401 for authenticated requests without resolved tenant context.

If TenantHeaderName is active in a production-style host, also register AddPrimusMultiTenancyMembershipValidatedSelection() with a real membership store path. Startup validation blocks unvalidated header-based tenant selection otherwise.

UsePrimusTenantEntitlements() enforces endpoint feature requirements against tenant tier metadata.

Feature-gated endpoints

builder.Services.Configure<MultiTenancyOptions>(o =>
{
	o.PerTierEntitlements["Free"] = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
	{
		"dashboard.view"
	};
	o.PerTierEntitlements["Pro"] = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
	{
		"dashboard.view",
		"reports.export"
	};
	o.DefaultTenantTier = "Free";
});

app.MapGet("/reports/export", ExportHandler)
   .RequirePrimusFeature("reports.export");

If the current tenant tier is not entitled, the middleware returns 403 and records TenantEntitlementDenied through ITenantAuditSink.

Advanced hooks

AddPrimusMultiTenancyAspNetCore() registers defaults for:

  • ITenantRateLimiterInMemoryTenantRateLimiter
  • ITenantBypassPolicyDefaultTenantBypassPolicy

For multi-instance deployments, replace ITenantRateLimiter with a distributed implementation.

builder.Services.AddSingleton<ITenantRateLimiter, RedisTenantRateLimiter>();

To control support/super-admin access, override bypass policy:

builder.Services.AddSingleton<ITenantBypassPolicy, ApprovalBackedBypassPolicy>();

When bypass policy denies access, middleware returns 403 with Super-admin bypass denied.

Authenticated bootstrap flows without tenant context

If you compose this package with flows that create a user's first tenant membership, register ITenantRequirementExemptionPolicy to allow only those specific requests through before a tenant context exists.

Typical example:

  • POST /primus/invitations/{invitationId}/accept

Do not exempt broad path prefixes or all authenticated requests. Keep the policy narrow and auditable.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 101 4/3/2026
1.0.0 122 3/31/2026