Install
| Product | Versions |
|---|---|
| .NET |
README
Senparc.Xncf.Tenant
Senparc.Xncf.Tenant provides NCF multi-tenant persistence, request resolution, caching, and service integration.
Features
- Persists
TenantInforecords through a tenant database context and repository. - Resolves the current request tenant through middleware.
- Provides
TenantInfoService, tenant DTO mapping, and cached full-tenant information. - Supports provider-specific contexts and NCF multi-database migrations.
Installation
<PackageReference Include="Senparc.Xncf.Tenant" Version="0.26.0-preview3" />
Key API
Register.AddMultiTenant(...)registers tenant services and middleware dependencies.TenantMiddlewareresolves tenant context for an HTTP request.TenantInfoService.GetRequestTenantInfo(...)andSetTenantInfo(...)read/update tenant information.TenantInfoRepositoryandFullTenantInfoCacheprovide persistence and cached lookup.SenparcEntitiesMultiTenantis the multi-tenant database context.
Choose and document the tenant-resolution source, fail closed when a tenant cannot be resolved, and ensure every business query applies the resolved tenant boundary.
When using TenantRule.RequestHeader, anonymous requests can select a tenant by sending
TenantKey. Requests authenticated with the NCF admin cookie must present the same
tenant key as their authenticated TenantKey claim; accounts without a tenant claim
cannot switch tenants. When the header is absent, a signed-in tenant user retains
the tenant from their cookie claim rather than falling back to the default tenant.
Requests with an Authorization header and TenantKey are
rejected until their authentication scheme is explicitly bound to a tenant. A trusted
proxy should strip client-supplied tenant headers if it injects its own.
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.