- ABP Framework version: v4.2.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC): yes
- Exception message and stack trace:
- Steps to reproduce the issue:
Hello ,
We use multitenancy as db per customer approach. We have different db's for different tenants, so we don't want to add TenantId column into our tenant dependent database tables . When we remove IMultiTenant interface from our tenant spesific entities , the application couldn't get tenant connection string correctly , it gives us host connection string. But when we implement IMultiTenant interface it can give us correct tenant connection string. We add some of the screenshot below with IMultiTenant usage or without it. What could be the possible problem here ? Because we can get CurrentTenant informations correctly . But when getting tenant connection string it is all wrong without IMultiTenant implementation ? Could you help about issue.
Thank you.
7 Answer(s)
-
0
We use multitenancy as db per customer approach. We have different db's for different tenants, so we don't want to add TenantId column into our tenant dependent database tables .
Can't say that I understand completely. Assuming you have a
Product
entity enabled for all entities. Each tenant has their own Product tables. But you don't want them to haveTenantId
column? Is that the case?When we remove IMultiTenant interface from our tenant spesific entities , the application couldn't get tenant connection string correctly , it gives us host connection string. But when we implement IMultiTenant interface it can give us correct tenant connection string.
I think this makes sense. When you don't have IMultiTenant, connection string falls back to default host connectionstring. Otherwise how to figure out which tenant connection string it is to check in
SaasTenantConnectionStrings
?Please point out if I misunderstood.
-
0
Hello,
I think there are misunderstandings , could we arrange a desktop sharing session and I can show you from my computer the issue , It will be more understandable I think , Is it ok ?
Thank you.
-
0
Sorry that I am not able to make screenshare sessions at the moment. Would you mind to explain your situation via this platform so that other users that might be experiencing the same issue can also benefit?
-
0
1- We use multitenancy with db per tenant approach. 2- We store all tenants and connection strings inside host database naturally 3- We have a seperate application which created with suite and this application works with our platform 4- We gave this application inside editions , for example if tenant has standard edition than we don't show anything about this application but if edition is premium tenant and users can see this application and pages 5- This application has its own ef core context and own entities , also has identity and abp spesific tables , too 6 - When we login, we login with tenant and I think when we login with tenant , the abp backend changes our connection string depends on logged in tenant connection string ? 7- After login with tenant if this application spesific entities don't implement IMultiTenant interface than we got error because of wrong connection string but the interesting thing system knows my current tenant Id but the connection string is not correct . 8- When we add IMultitTenant to these entities it resolves correctly. 9- But all abp tables don't have TenantId right ? However they could work correctly ? 10 - So why we need to add IMultiTenant interface to our spesific entities which is stored in tenant depended database already ? When we login it should be getting correct connection string , right ?
I hope it is clear. Thank you.
-
0
-
0
Any chance that this could be improved? We use a one-db-per-tenant approach as well, and having TenantID columns is just distracting :)
-
0
hi MichelZ I will discuss with the team.