The shared contracts: tenant info, strategy, store, and tenant context interfaces, with no implementation dependencies.
MultiTenant Abstractions holds the interfaces and basic types every other MultiTenant package is built on: ITenantInfo and TenantInfo, IMultiTenantStrategy, IMultiTenantStore, ITenantContext, and the [MultiTenant] attribute.
Reference it from class libraries, domain projects, and extensions that need to talk about tenants without taking a dependency on the full MultiTenant implementation, ASP.NET Core, or EF Core.
dotnet add package Finbuckle.MultiTenant.Abstractions
using Finbuckle.MultiTenant.Abstractions;
public class AppTenantInfo : TenantInfo<string>
{
public string? Name { get; init; }
}Releases
| Version | Targets | Released | Release notes |
|---|---|---|---|
| v11.0.0New | .NET 11 | Nov 24, 2026 | Release notes |
| v10.2.0 | .NET 10 | Nov 12, 2026 | Release notes |
Mark entities in your domain project
The [MultiTenant] attribute lives in Abstractions, so domain and model projects can mark entities as multi-tenant without referencing EF Core.
- Keep persistence concerns out of the domain layer.
- MultiTenant EF Core picks the attribute up in the data project.
using Finbuckle.MultiTenant.Abstractions;
[MultiTenant]
public class Invoice
{
public int Id { get; set; }
public decimal Amount { get; set; }
}Write your own strategies
Implement IMultiTenantStrategy to identify tenants from any source, and ship it in a library that only depends on Abstractions.
- One method: return the tenant identifier for a context, or null.
- Set a priority to control the order strategies run in.
- Register it with WithStrategy in the app.
public class ApiKeyStrategy : IMultiTenantStrategy
{
public Task<string?> GetIdentifierAsync(object context) =>
Task.FromResult(context is HttpContext http
? ApiKeys.LookupTenant(http.Request.Headers["X-Api-Key"])
: null);
}
builder.Services.AddMultiTenant<AppTenantInfo, string>()
.WithStrategy<ApiKeyStrategy>(ServiceLifetime.Singleton);Write your own stores
Implement IMultiTenantStore to load tenants from a system MultiTenant doesn't cover, such as an existing customer database or an internal API.
- Look up tenants by ID or identifier.
- Optional add, update, and remove for runtime tenant management.
- Register it with WithStore in the app.
public class CrmTenantStore(CrmClient crm)
: IMultiTenantStore<AppTenantInfo, string>
{
public Task<AppTenantInfo?> GetByIdentifierAsync(string identifier,
CancellationToken cancellationToken = default) =>
crm.FindAccountAsync(identifier, cancellationToken);
// ...other members
}
builder.Services.AddMultiTenant<AppTenantInfo, string>()
.WithStore<CrmTenantStore>(ServiceLifetime.Scoped);The rest of the MultiTenant family
MultiTenant
Finbuckle.
The foundation: tenant resolution, tenant stores, per-tenant options, and running work as a tenant in any .NET app.
Learn moreMultiTenant for ASP.NET Core
Finbuckle.
Middleware, request-based strategies, and per-tenant authentication for ASP.NET Core apps.
Learn moreMultiTenant for EF Core
Finbuckle.
Per-tenant data isolation for EF Core, in a shared database, a database per tenant, or a mix of both.
Learn moreMultiTenant Identity
Finbuckle.
Multi-tenant ASP.NET Core Identity: each tenant gets its own users, roles, and passkeys.
Learn more