Substantive.AspNetCore.MultiTenant 9.17.24-build20260209r1
This package provides a standardized way to configure Finbuckle.MultiTenant for ASP.NET Core applications, with first-class support for Razor Pages, multiple tenant stores, and pluggable tenant resolution strategies.
A. Installation
1. Install the package
Install the package via NuGet or update directly in the .csproj file.
<PackageReference Include="Substantive.AspNetCore.MultiTenant" Version="1.*" />
2. Add configuration
Add the configuration below to the appsettings.json or to the configuration provider you are using.
Configure MultiTenantOptions using appsettings.json (or any other configuration provider).
Key settings:
Strategy– Tenant resolution strategy (Header,Route, orHost)TenantStrategyParameter– Header name, route parameter, or host token depending on the strategyEndpointTemplate– Required only for HTTP remote storeDefaultTenantInfo– Optional fallback tenant (not recommended for production)
{
"MultiTenantOptions": {
"Strategy": "Route",
"TenantStrategyParameter": "tenant",
"EndpointTemplate": "https://tenants.example.com/api/tenants/{tenantId}",
"DefaultTenantInfo": {
"Id": "00000000-0000-0000-0000-000000000001",
"Identifier": "default",
"Name": "Default Tenant"
}
}
}
3. Configure services
Configure the service and configuration into the service collection.
Bind options and register the appropriate tenant store.
Razor Pages (recommended)
builder.Services.AddMultiTenantWithEFCoreStore<TenantStoreDbContext, TenantInfo>(options =>
{
builder.Configuration.GetSection(nameof(MultiTenantOptions)).Bind(options);
});
B. Choosing the correct store
| Store | Recommended use cases |
|---|---|
| In-memory | Tests, local development, demos |
| EF Core | Monolithic apps, Razor Pages, single database |
| HTTP remote | Microservices, shared tenant catalog |
C. Tenant resolution strategies
| Strategy | When to use |
|---|---|
| Header | APIs, SPA backends |
| Route | Razor Pages (for example: /{tenant}/Index) |
| Host | SaaS with subdomains |
D. Usage
B. Usages
Inject ITenantInfo or IMultiTenantContextAccessor<TenantInfo> where needed.
private readonly ITenantInfo tenant;
public IndexModel(ITenantInfo tenant)
{
this.tenant = tenant;
}
E. Notes and best practices
- Avoid
DefaultTenantInfoin production environments - Do not register multiple tenant stores in the same application
- Centralize tenant lifecycle management when using the HTTP remote store
Showing the top 20 packages that depend on Substantive.AspNetCore.MultiTenant.
| Packages | Downloads |
|---|---|
|
Substantive.AspNetCore
Package Description
|
10 |
|
Substantive.AspNetCore
Package Description
|
12 |
|
Substantive.AspNetCore
Package Description
|
43 |
|
Substantive.AspNetCore
Package Description
|
91 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
13 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
19 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
20 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
21 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
22 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
24 |
|
Substantive.AspNetCore
Substantive ASP.NET Core package.
|
27 |
|
Substantive.AspNetCore
Substantive untitled internal package.
|
14 |
|
Substantive.AspNetCore
Substantive untitled internal package.
|
29 |
|
Substantive.AspNetCore
Substantive untitled internal package.
|
31 |
|
Substantive.AspNetCore
Substantive untitled internal package.
|
52 |
|
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
|
14 |
|
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
|
16 |
.NET 10.0
- Finbuckle.MultiTenant (>= 10.0.2)
- Finbuckle.MultiTenant.AspNetCore (>= 10.0.2)
- Finbuckle.MultiTenant.EntityFrameworkCore (>= 10.0.2)