TCIS.MultiTenancy 1.0.0-rc.9

This is a prerelease version of TCIS.MultiTenancy.
dotnet add package TCIS.MultiTenancy --version 1.0.0-rc.9
                    
NuGet\Install-Package TCIS.MultiTenancy -Version 1.0.0-rc.9
                    
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="TCIS.MultiTenancy" Version="1.0.0-rc.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TCIS.MultiTenancy" Version="1.0.0-rc.9" />
                    
Directory.Packages.props
<PackageReference Include="TCIS.MultiTenancy" />
                    
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 TCIS.MultiTenancy --version 1.0.0-rc.9
                    
#r "nuget: TCIS.MultiTenancy, 1.0.0-rc.9"
                    
#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 TCIS.MultiTenancy@1.0.0-rc.9
                    
#: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=TCIS.MultiTenancy&version=1.0.0-rc.9&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=TCIS.MultiTenancy&version=1.0.0-rc.9&prerelease
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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