0
elhajjh created
- ABP Framework version: v8.1.3
- UI Type: Angular
- Database System: EF Core (SQL Server)
I have some questions about multi-tenancy:
- In our case, we are using a Single Database for all tenants.
- I have some data that is common and shared between all tenants, So I need to return the data for the current tenant plus the data that is common to all tenants, which in my case I assume it(the common data) has a value of "NULL" in the tenant field.
Can we do so and how, please?
Thank you
3 Answer(s)
-
0
Hi,
You can make the
Entity
as a HostEntity
Then change the current tenant context when querying shared data https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant
using (CurrentTenant.Change(null)) // change to host { return await _productRepository.GetCountAsync(); }
-
0
Hi Sorry you did not understand me.
I need to retrieve the data of the current tenant plus the common data in one query
Means, result = get data where tenant id = current tenant or tenant id = null
I want this to be automatic for any query
Thank you
-
0
Hi,
ok, you need to add a custom the data filters https://docs.abp.io/en/abp/latest/Data-Filtering#defining-custom-filters