0
MellowoodMedical created
Hi Support Team, I have one concerning about External Hangfire background service.
I do able inject HostDbContext
in HangfireAppService
.
But how can I inject IRepositoryTenantTable
base on TenantId
, or perhaps TenantConnectionString
?
And how can I inject ICustomRepository
base on TenantId
, or perhaps TenantConnectionString
?
Implement of ICustomRepository has some function/methods that I would like to re-use instead of create new TenantDbContext
1 Answer(s)
-
0
Hi @MellowoodMedical
You can switch between Host and Tenant context, see https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#switching-between-host-and-tenants. If you swithc the Tenant context, the repositories will access the TenantDbContext.