a multitenancy library for

ASP.NET Core 3.1, 3.0, and 2.1 are actively supported.

Get Started!

Tenant Resolution

Detect tenants using built-in or custom strategies.

Data Isolation

Separate tenant data using a single or multiple databases.


Support for most authentication schemes and Identity.


Configure application behavior uniquely for each tenant.

Open Source

Source code available on GitHub under the Apache 2.0 license.


Use standard ASP.NET Core conventions and patterns.


Install the Finbuckle.MultiTenant NuGet package.


$ dotnet add package Finbuckle.MultiTenant

Package Manager

> Install-Package Finbuckle.MultiTenant


Configure the services by calling AddMultiTenant followed by its builder methods in the app's ConfigureServices method. Here we are using the host strategy and in-memory store, but Finbuckle.MultiTenant comes with several other multitenant strategies and stores.

public void ConfigureServices(IServiceCollection services)

Configure the middleware by calling UseMultiTenant in the app's Configure method. Be sure to call it before calling UseMvc and other middleware which will use per-tenant functionality.

public void Configure(IApplicationBuilder app)
    app.UseMultiTenant(); // Before UseMvc!

With the services and middleware configured, access information for the current tenant from the TenantInfo property on the MultiTenantContext object accessed from the GetMultiTenantContext extension method. If the current tenant could not be determined then TenantInfo will be null.

var tenantInfo = HttpContext.GetMultiTenantContext().TenantInfo;

if(tenantInfo != null)
    var tenantId = tenantInfo.Id;
    var identifier = tenantInfo.Identifier;
    var name = tenantInfo.Name;
    var something = tenantInfo.Items["something"];

The TenantInfo property holds basic details about a tenant and enables customization of the app on a on a per-tenant basis in any way you want.

Finbuckle.MultiTenant uses TenantInfo internally to provide built-in functionality such as per-tenant options, per-tenant authentication, and per-tenant data isolation.

Compiling from Source

From the command line clone the git repository, cd into the new directory, and compile with dotnet build.

$ git clone
$ cd Finbuckle.MultiTenant
Cloning into 'Finbuckle.MultiTenant'...
<output omitted>
$ cd Finbuckle.MultiTenant
$ dotnet build

Run the unit tests from the command line with dotnet test from the solution directory.

$ dotnet test