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.
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" />
<PackageReference Include="XiHan.Framework.MultiTenancy.InMemory" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=XiHan.Framework.MultiTenancy.InMemory&version=5.0.0-preview.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Diagnostics.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- System.Threading.RateLimiting (>= 10.0.14)
- XiHan.Framework.MultiTenancy.Abstractions (>= 5.0.0-preview.1)
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 |