XiHan.Framework.MultiTenancy.InMemory 5.0.0-preview.1

Prefix Reserved
This is a prerelease version of XiHan.Framework.MultiTenancy.InMemory.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package XiHan.Framework.MultiTenancy.InMemory --version 5.0.0-preview.1
                    
NuGet\Install-Package XiHan.Framework.MultiTenancy.InMemory -Version 5.0.0-preview.1
                    
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="XiHan.Framework.MultiTenancy.InMemory" Version="5.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.MultiTenancy.InMemory" Version="5.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.MultiTenancy.InMemory" />
                    
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 XiHan.Framework.MultiTenancy.InMemory --version 5.0.0-preview.1
                    
#r "nuget: XiHan.Framework.MultiTenancy.InMemory, 5.0.0-preview.1"
                    
#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 XiHan.Framework.MultiTenancy.InMemory@5.0.0-preview.1
                    
#: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=XiHan.Framework.MultiTenancy.InMemory&version=5.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.MultiTenancy.InMemory&version=5.0.0-preview.1&prerelease
                    
Install as a Cake Tool

XiHan.Framework.MultiTenancy.InMemory

内存租户存储。清单 role: default,提供 multitenancy.context@1 与 multitenancy.sharding@1。

{
  "XiHan": {
    "MultiTenancy": {
      "RequireTenant": false,
      "Tenants": {
        "acme": { "DisplayName": "Acme", "IsEnabled": true, "Properties": { "ConnectionString": "Host=acme-db;Database=app", "DatabaseProvider": "postgresql" } },
        "beta": { "IsEnabled": false }
      }
    }
  }
}

语义

  • 启动时从 XiHan:MultiTenancy:Tenants 装载;运行时可用 InMemoryTenantStore.Set / Remove 增删,上限 XiHan:MultiTenancy:InMemory:MaxTenants(默认 1000),超出返回 MULTITENANCY_UNAVAILABLE_001。
  • 注册解析器顺序:ClaimTenantResolver(已认证主体的 tenant 声明)→ BaggageTenantResolver(xihan.tenant)。
  • 在 Tenant 阶段加入 TenantResolutionMiddleware。存储、解析器、中间件与健康项只在租户上下文能力被选中时注册:应用自带的 Provider 只提供 multitenancy.context@1 时它们都归那个 Provider,本包只提供分片(RFC-0007「存储」)。
  • 分片能力被选中时注册 TenantStoreShardResolver:租户属性 ConnectionString 有值即分库,DatabaseProvider 为提供者名,Shard.<key> 透传;结果按租户缓存(XiHan:MultiTenancy:ShardCacheSize,正整数,默认 10000,由 MultiTenancyOptions.FromConfiguration 读取),Set / Remove 改了租户连接后调用 ITenantShardResolver.Invalidate。
  • 健康项 multitenancy.inmemory.capacity(存储自己实现,同步计算):租户数达到 MaxTenants 即 Degraded(MULTITENANCY_UNAVAILABLE_001),否则 Ready。

依赖方向

依赖 XiHan.Framework.MultiTenancy.Abstractions。

状态

P2:可用,通过 MultiTenancy.Conformance 套件。

Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on XiHan.Framework.MultiTenancy.InMemory:

Package Downloads
XiHan.Framework.Profiles.Standard

曦寒框架 Standard 组合包

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0-preview.2 43 11/6/2026
5.0.0-preview.1 48 11/4/2026