Multi-tenancy toolkit for .NET

Multi-tenancy for .NET, done properly.

Tenantry gives .NET apps real tenant isolation — a shared database with row-level scoping, a database per tenant, or a schema per tenant — with provisioning, lifecycle management, and migration orchestration across tenant databases.

Program.csTenantry Core
builder.Services.AddTenantry<Guid>(tenant =>
{
    tenant.ResolveFromHeader("X-Tenant-Id");
    tenant.UseInMemoryStore(tenants);
    tenant.AddEfCoreIsolation(options =>
        options.DetectSpoofedWrites = true);
});

// Tenant-owned: EF Core stamps TenantId on insert
// and scopes every query to the current tenant.
public class Order : TenantScoped<Guid>
{
    public int Id { get; set; }
}

Unopinionated

A Guid, int, string or any parsable tenant key. Resolve tenants from a header, subdomain, route, claim or query string, and store them anywhere.

Fails closed

With no tenant resolved, queries match nothing. Updates and deletes of another tenant’s rows are rejected before saving.

No base class required

Stamping and cross-tenant write protection work on any DbContext through EF Core interceptors and query filters.

HTTP and beyond

Resolution middleware and access validation for ASP.NET Core, and the same isolation in console, worker and desktop hosts.

Open-source Core. Pro for many databases.

Core covers identifying tenants and isolating their data. Pro adds what running many tenant databases takes.

Tenantry Core

Free · Apache-2.0

Tenant resolution and EF Core isolation, in a shared database or a database per tenant.

  • Tenant resolution, stores and access control, in ASP.NET Core and in console, worker and desktop hosts
  • Isolation in a shared database, with a TenantId column that EF Core scopes reads and writes to
  • A database per tenant, with per-tenant connection strings and DbContext pooling
  • Worker scopes for running background work as a tenant

Tenantry Pro

Subscription

The tooling to run many tenant databases in production.

  • A schema per tenant (SQL Server, PostgreSQL) and mixed mode
  • Provisioning of tenant databases on SQL Server, PostgreSQL and MySQL, and of schemas on SQL Server and PostgreSQL
  • Migration orchestration across every tenant database, and the provision → migrate → seed lifecycle
  • Caching of connection strings
  • Tenant context in Hangfire, MassTransit, Quartz.NET and Rebus, health checks, audit logging and telemetry

Pricing

One Pro subscription, billed monthly or yearly. Tenantry Core stays free and open source.

Tenantry Pro

per month

The tooling to run many tenant databases in production.

  • Tenant provisioning, lifecycle & migration orchestration across tenant databases
  • Provisioning on SQL Server, PostgreSQL & MySQL
  • Schema-per-tenant (SQL Server & PostgreSQL) and mixed mode
  • Connection-string caching
  • Hangfire, MassTransit, Quartz & Rebus integrations
  • Audit logging, health checks & OpenTelemetry metrics
  • Private NuGet package feed
  • Email support