- ABP Framework version: v7.4.0
- UI Type: Angular
- Database System: EF Core (SQL Server)
Hello, Is the following scenario possible to accomplish within the framework? How? We are implementing a Database Per Tenant multitenancy architecture. Our customers have multiple facilities and they need to create reports across those facilities, so we need to do cross-database queries, we are hosting in Azure so I don't want to do cross-database queries but be able to host the tenant facilities in a single database so that it is easier to query across the facility tenants.
Is it possible to have a multiple hybrid approach? for example:
Customer-A Customer-A-DB (SQL Database) Facility-a (TenantId: xxxx-xxxxx-xxxx) Facility-b (TenantId: xxxx-xxxxx-xxxx) Facility-c (TenantId: xxxx-xxxxx-xxxx)
Customer-B Customer-B-DB (SQL Database) Facility-a (TenantId: xxxx-xxxxx-xxxx) Facility-b (TenantId: xxxx-xxxxx-xxxx) Facility-c (TenantId: xxxx-xxxxx-xxxx)
Customer-C Customer-C-DB (SQL Database) Facility-a (TenantId: xxxx-xxxxx-xxxx) Facility-b (TenantId: xxxx-xxxxx-xxxx) Facility-c (TenantId: xxxx-xxxxx-xxxx)
TIA.
5 Answer(s)
-
0
Hi,
As I understand, a customer is a tenant. a facility can belong to multiple customers.
Just an idea:
The
Facility
entity should not implement theIMultiTenant
interface, so It will be in the host database.public class Facility: ... { public List<Guid> TenantIds {get; set;} } public class TestAppService:.... { private readonly IRepository<Facility, Guid> _reopsitory; ..... public async Task GetReportAsync() { var currentTenantId = CurrentTenant.GetId(); //Switch to host using(CurrentTenant.Change(null)) { var result = await _reopsitory.GetListAsync(x => x.TenantIds.Contains(currentTenantId)); } } }
-
0
-
0
Hi,
I need to implement multiple Hybrid architectures where some tenants share a single database while some tenants may have their own database.
Yes, it's possible, but I still don't know what's blocked you.
-
0
I need some guidance on how to accomplish it, it is not clear in the documentation for creating tenants, that's my block.
Update: I created 3 tenants with the same connection-string. When creating the first one, the database was created, then I created the two additional tenants with the same connection but the admin user and role records were not created.
-
0
When creating the first one, the database was created, then I created the two additional tenants with the same connection but the admin user and role records were not created.
Could you share the steps to reproduce? I will check it out. thanks