Skip to main content
net10.0

系统核心模块(运行系统必须)

Published
Oct 4, 2026
15d ago
Total Downloads
25.0K
25,030

Install

dotnet add package Senparc.Xncf.Tenant --version 0.15.14
ProductVersions
.NET
net10.0

README

Senparc.Xncf.Tenant

Senparc.Xncf.Tenant provides NCF multi-tenant persistence, request resolution, caching, and service integration.

Features

  • Persists TenantInfo records 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.
  • TenantMiddleware resolves tenant context for an HTTP request.
  • TenantInfoService.GetRequestTenantInfo(...) and SetTenantInfo(...) read/update tenant information.
  • TenantInfoRepository and FullTenantInfoCache provide persistence and cached lookup.
  • SenparcEntitiesMultiTenant is 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

No structural changes between v0.15.10 and v0.15.14.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.