/abp-sensei:abp-multitenancyfrom ABP Sensei
ABP Framework v10.x (10.4–10.6) multi-tenancy: tenant resolver, ICurrentTenant, IMultiTenant, database isolation, tenant-based data filtering. Use when working with SaaS, multi-tenancy, or tenant management in ABP.
Ships in ABP Sensei. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ABP Framework v10.x (10.4–10.6) multi-tenancy (SaaS) implementation guide. Tenant resolver, IMultiTenant, ICurrentTenant, database isolation.
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = true;
});
In the startup templates this is controlled from a single point via the
MultiTenancyConstsclass.
| Approach | Description |
|---|---|
| Single Database | All tenants in the same DB, separated by TenantId |
| Database per Tenant | Each tenant has its own DB |
| Hybrid | Some tenants share a DB, others have a separate DB |
public class Product : AggregateRoot<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; } // From the IMultiTenant interface
public string Name { get; set; }
public float Price { get; set; }
}
Important:
TenantId is nullable — if null, the entity belongs to the HostTenantId is set automatically (from ICurrentTenant.Id)// Properties
CurrentTenant.Id // Guid? — Current tenant ID
CurrentTenant.Name // string — Current tenant name
CurrentTenant.IsAvailable // bool — true if ID is not null
// Changing the tenant (scoped)
using (CurrentTenant.Change(tenantId))
{
// Within this scope, operations are performed on behalf of the specified tenant
var count = await _productRepository.GetCountAsync();
}
// Switch to the host context
using (CurrentTenant.Change(null))
{
// Operation in the host context
}
public class ProductManager : DomainService
{
private readonly IRepository<Product, Guid> _productRepository;
private readonly IDataFilter _dataFilter;
public ProductManager(IRepository<Product, Guid> productRepository, IDataFilter dataFilter)
{
_productRepository = productRepository;
_dataFilter = dataFilter;
}
public async Task<long> GetAllProductCountAsync()
{
using (_dataFilter.Disable<IMultiTenant>())
{
return await _productRepository.GetCountAsync();
}
}
}
?__tenant=xxx__tenant)__tenant)Configure<AbpAspNetCoreMultiTenancyOptions>(options =>
{
options.TenantKey = "MyTenantKey";
});
// Subdomain: mytenant.mydomain.com
Configure<AbpTenantResolveOptions>(options =>
{
options.AddDomainTenantResolver("{0}.mydomain.com");
});
// OpenIddict wildcard domain (if a separate Auth Server is used)
PreConfigure<AbpOpenIddictWildcardDomainOptions>(options =>
{
options.EnableWildcardDomainSupport = true;
options.WildcardDomainsFormat.Add("https://{0}.mydomain.com");
});
public class MyCustomTenantResolveContributor : TenantResolveContributorBase
{
public override string Name => "Custom";
public override Task ResolveAsync(ITenantResolveContext context)
{
// Set context.TenantIdOrName
// Use DI via context.ServiceProvider
return Task.CompletedTask;
}
}
// Registration
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Add(new MyCustomTenantResolveContributor());
});
Configure<AbpTenantResolveOptions>(options =>
{
options.FallbackTenant = "acme"; // Used when no tenant is found
});
app.UseAuthentication();
app.UseMultiTenancy(); // Immediately after authentication
Already configured in the startup templates.
Included in the startup templates. The ITenantStore implementation fetches tenant information from the DB.
// appsettings.json
"Tenants": [
{
"Id": "446a5211-3d72-4339-9adc-845151f8ada0",
"Name": "tenant1",
"NormalizedName": "TENANT1"
},
{
"Id": "25388015-ef1c-4355-9c18-f6b6ddbaf89d",
"Name": "tenant2",
"NormalizedName": "TENANT2",
"ConnectionStrings": {
"Default": "...tenant2's connection string..."
}
}
]
[IgnoreMultiTenancy] // Always uses the host DB
public class TenantManagementDbContext : AbpDbContext<TenantManagementDbContext> { }
In ABP, the following services are designed to be multi-tenancy-aware:
IMultiTenant — For tenant-specific entitiesCurrentTenant.Change with using — The previous value is restored outside the scopeCurrentUserTenantResolveContributor must always be firstCurrentTenant.Change(null) for host-side operationsappsettings.json approach is only for simple scenariosWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub burakdmir/abp-skills --plugin abp-sensei26 skills in this plugin
/abp-aiABP Framework v10.x (10.4–10.6) AI integration: Microsoft.Extensions.AI (IChatClient), Semantic Kernel, Microsoft Agent Framework, AI Workspaces, AI Management module (Pro) with RAG, document indexing/chunking and MCP servers. Use when you need chat clients, AI agents, RAG or AI workspace management in ABP./abp-apiABP Framework v10.x (10.4–10.6) API development: Auto API Controllers, dynamic and static C#/JS client proxies, Swagger, API versioning, Integration Services. Use when you need a REST API, controller, dynamic proxy or client generation in ABP./abp-audit-loggingABP Framework v10.x (10.4–10.6) audit logging: AbpAuditingOptions, entity history, IAuditingStore, audit log storage and filtering. Use when configuring audit trails, audit logs, or entity history in ABP./abp-authorizationABP Framework v10.x (10.4–10.6) authorization: defining permissions (PermissionDefinitionProvider), [Authorize], CheckPolicyAsync/IsGrantedAsync, CurrentUser, IPermissionManager, resource-based auth, multi-tenancy permissions. Use when you need permission, role or access checks in ABP./abp-cliABP Framework v10.x (10.4–10.6) CLI and tooling: abp new, add-package, generate-proxy, ABP Studio, ABP Suite, --modern flag. Use when working with ABP CLI commands, creating projects, adding packages, or generating proxies./abp-daprABP Framework v10.x (10.4–10.6) Dapr integration: Volo.Abp.Dapr packages, service invocation via C# API client proxies (Volo.Abp.Http.Client.Dapr), distributed event bus over Dapr pub/sub (Volo.Abp.EventBus.Dapr + Volo.Abp.AspNetCore.Mvc.Dapr.EventBus), distributed lock, AbpDaprOptions, API token security. Use when you need Dapr sidecar communication, Dapr pub/sub, or Dapr service invocation in ABP.Other plugins' skills for the same job