- ABP Framework version: v4.4.4
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): Tiered/Identity Server
I have separate DB's for each tenant in our solution. We are migrating legacy data for each tenant and do not wish to use the TenantID (Guid) that comes along with using the IMultiTenancy interface on our domain classes used to map to our DB tables. However if we don't implement this interface on our domain class the EFCoreRepository class changes the current tenant to null before getting the connection string, so as a result it gets the host connection string and not the tenant's connection string.
How do I do this?
4 Answer(s)
-
0
Hi,
This is the design of a multi-tenant system, I'm sorry to tell you that you can't change it.
-
0
Hi,
If you use a separate database for each tenant, you can remove the IMultiTenant
-
0
Hi Spospisil, I had ran into the exact same problem, but was forced to implement IMultiTenancy even with separate databases for each tenant. I am using version 4.4.3 though.
Are you still running into this issue?
-
0
Hi,
If the entity is not multi-tenant, then it will always switch to host
See https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs#L39
You can custom your own repository base and override
GetDbContext
andGetDbContextAsync
methods.See https://docs.abp.io/en/abp/latest/Entity-Framework-Core#set-default-repository-classes