abp-multi-tenancy

Implements tenant-aware entities and tenant context switching in ABP Framework applications.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/afonsoft/gamehub --skill abp-multi-tenancy-afonsoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: abp-multi-tenancy
Source: https://github.com/afonsoft/gamehub/tree/main/.claude/skills/abp-multi-tenancy
Command: npx skills add https://github.com/afonsoft/gamehub --skill abp-multi-tenancy-afonsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building multi-tenant applications on the ABP Framework often struggle with correctly isolating tenant data, switching tenant context for host operations, and querying across tenants without breaking the automatic filtering behavior. ## Core Features & Use Cases - Tenant-Aware Entities: Implement the IMultiTenant interface so ABP automatically filters queries and sets TenantId on creation. - Tenant Context Switching: Use CurrentTenant.Change() inside a using block to run operations in a specific tenant or host context safely. - Cross-Tenant Queries: Disable the IMultiTenant data filter to aggregate data across all tenants in a single-database setup. - Use Case: A SaaS admin dashboard needs total product counts across every tenant; wrap the repository call in DataFilter.Disable<IMultiTenant>() to aggregate without manual TenantId filtering. ## Quick Start Ask the AI to make an existing ABP entity multi-tenant and show how to query data across all tenants from a domain service.

Frequently Asked Questions about abp-multi-tenancy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make an entity multi-tenant in ABP Framework?▼

Implement the IMultiTenant interface on your entity, which adds a nullable TenantId property. ABP then automatically filters queries by the current tenant and sets TenantId when creating entities, so no manual filtering is needed.

How to switch tenant context in ABP with CurrentTenant.Change?▼

Wrap the operation in a using block with CurrentTenant.Change(tenantId) to run code under a specific tenant, or pass null for host context. The previous tenant is automatically restored when the using block exits.

How do I query data from all tenants in ABP?▼

Use DataFilter.Disable<IMultiTenant>() inside a using block to bypass the automatic tenant filter and query all tenants' data. This only works with a single shared database, not with database-per-tenant setups.

Does ABP multi-tenancy support a separate database per tenant?▼

Yes, ABP supports single database, database-per-tenant, and hybrid architectures, with connection strings configured per tenant in the Tenant Management module. Note that disabling the IMultiTenant filter does not work across separate databases.

How does ABP resolve the current tenant from a request?▼

ABP resolves the tenant in order from user claims, query string, route values, the __tenant HTTP header, cookies, and finally domain or subdomain if configured. Subdomain resolution is enabled via AbpTenantResolveOptions with a pattern like {0}.mydomain.com.