Hello,
We need to get the data from a table which is added under MustHaveTenant entity, some case we need to add data as a seed for all tenants with tenantid as ZERO. we need to get the data which comes under the logged in Tenantid as well as common data which we gave Id as ZERO.
How we can achieve this?
Thanks.
6 Answer(s)
-
0
Hi, can you explain the use using more concrete examples?
it might not be necessary to store seed data with tenant-id = 0 if you only need to seed data for all tenant
-
0
With Example:
An Entity Book, we have some common books for all tenants, that should show for all tenant users. but also have tenant-specific books that should show only for that specific tenant user.
In a lookup table should show the data which is common as well as specific tenant.
-
0
Do the common books fixed for all tenants?
Also, do the common books change over time?
-
0
Do the common books fixed for all tenants?
Yes, This is common seed for all tenant, we will add as seed in EF.
Also, do the common books change over time?
No.
-
0
Simply override CreateFilterExpression for
IMayHaveTenant
and/orIMustHaveTenant
in your DbContext.Change
((IMayHaveTenant)e).TenantId == CurrentTenantId
to(((IMayHaveTenant)e).TenantId == CurrentTenantId || (((IMayHaveTenant)e).TenantId == 0)
. -
0
Hi @Aaron,
Let me try on this way.
Thnaks for the help.