TCIS.MultiTenancy
1.0.0-rc.9
dotnet add package TCIS.MultiTenancy --version 1.0.0-rc.9
NuGet\Install-Package TCIS.MultiTenancy -Version 1.0.0-rc.9
<PackageReference Include="TCIS.MultiTenancy" Version="1.0.0-rc.9" />
<PackageVersion Include="TCIS.MultiTenancy" Version="1.0.0-rc.9" />
<PackageReference Include="TCIS.MultiTenancy" />
paket add TCIS.MultiTenancy --version 1.0.0-rc.9
#r "nuget: TCIS.MultiTenancy, 1.0.0-rc.9"
#:package TCIS.MultiTenancy@1.0.0-rc.9
#addin nuget:?package=TCIS.MultiTenancy&version=1.0.0-rc.9&prerelease
#tool nuget:?package=TCIS.MultiTenancy&version=1.0.0-rc.9&prerelease
TCIS.MultiTenancy
The library providing the core architecture to manage and resolve Multi-Tenancy information within the TCIS system.
🌟 Overview
TCIS.MultiTenancy provides a robust and flexible framework for:
- Tenant Resolver: Identifies the current tenant through various Strategies such as: Host-based, Header-based (for gRPC/REST), custom Delegate, or Static.
- Tenant Stores: Stores and retrieves tenant configuration via: Static Configuration (
IConfiguration), In-Memory, or distributed cache (IDistributedCache). - Flexible Integration: Suitable for all isolation levels (Isolation Tier 1 - RLS, Tier 2 - Schema, Tier 3 - Database).
📦 Installation
dotnet add package TCIS.MultiTenancy
⚙️ Configuration (appsettings.json)
Example with ConfigurationStore (reading the tenant list from appsettings):
{
"MultiTenancy": {
"Stores": {
"ConfigurationStore": {
"Tenants": [
{
"Id": "tenant-1",
"Identifier": "customer-a",
"Name": "Customer A",
"IsolationTier": "Tier2"
},
{
"Id": "tenant-2",
"Identifier": "customer-b",
"Name": "Customer B",
"IsolationTier": "Tier3"
}
]
}
}
}
}
🚀 Usage
In Program.cs, register the MultiTenancy service using the Fluent Builder API:
using TCIS.MultiTenancy.Extensions;
using TCIS.Core.Models; // Contains the TenantInfo class
var builder = WebApplication.CreateBuilder(args);
// Register services
builder.Services.AddTMultiTenant<TenantInfo>()
// 1. Configure the Tenant storage location (Store)
.WithConfigurationStore()
// Or a distributed cache
// .WithDistributedCacheStore(TimeSpan.FromHours(1))
// 2. Configure how to determine the Tenant (Strategy) from the request Context
.WithDelegateStrategy(context =>
{
if (context is HttpContext httpContext)
{
// Extract from the "X-Tenant-Id" Http Header
return Task.FromResult(httpContext.Request.Headers["X-Tenant-Id"].FirstOrDefault());
}
return Task.FromResult<string?>(null);
});
var app = builder.Build();
// Add the Middleware to the pipeline (if using ASP.NET) to set the Tenant for the current Request
// app.UseMultiTenant();
app.Run();
💡 Basic Example
How to access the current Tenant information within internal Services via ITenantContext:
using TCIS.Core.Abstractions.Context;
public class MyService
{
private readonly IWorkContextAccessor _contextAccessor;
public MyService(IWorkContextAccessor contextAccessor)
{
_contextAccessor = contextAccessor;
}
public void DoSomething()
{
var tenantContext = _contextAccessor.TenantContext;
if (tenantContext?.TenantInfo != null)
{
var currentTenantId = tenantContext.TenantInfo.Id;
var isolationTier = tenantContext.TenantInfo.IsolationTier;
// ... Tenant-specific logic
}
}
}
| Product | Versions 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 was computed. 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 was computed. 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. |
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.0)
- TCIS.Core (>= 1.0.0-rc.9)
- TCIS.Logging.Abstractions (>= 1.0.0-rc.9)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on TCIS.MultiTenancy:
| Package | Downloads |
|---|---|
|
TCIS.MultiTenancy.EntityFrameworkCore
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Entity Framework Core multi-tenancy integration for TCIS Framework. |
|
|
TCIS.MultiTenancy.AspNetCore
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. ASP.NET Core multi-tenancy integration for TCIS Framework. |
|
|
TCIS.Pluggable.Persistence.SqlServer
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Pluggable Persistence SqlServer |
|
|
TCIS.Pluggable.Persistence.Oracle
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Pluggable Persistence Oracle |
|
|
TCIS.Pluggable.Persistence.PostgreSql
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Pluggable Persistence PostgreSQL |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-rc.9 | 0 | 7/21/2026 |
| 1.0.0-rc.8 | 0 | 7/21/2026 |
| 1.0.0-rc.7 | 48 | 7/17/2026 |
| 1.0.0-rc.6 | 73 | 7/7/2026 |
| 1.0.0-rc.5 | 75 | 7/7/2026 |
| 1.0.0-rc.4 | 70 | 6/24/2026 |
| 1.0.0-rc.2 | 68 | 5/12/2026 |
| 1.0.0-rc.1 | 68 | 5/12/2026 |