We left Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

Help with Dependency Injection

Hi,

We are building a multi tenant infrastructure with single application and a separate database per tenant.

We have one scheduled hangfire job to run daily and this job queues several jobs - one per tenant.

Now these tenant jobs should all connect to different databases. At the moment DI instantiates all services required for this job with default Dbcontext. Can someone throw some pointers on how this could be achieved?

We are using .net core DI and API requests are served with data from different databases based on the httpcontext. The problem is that the job doesn’t have any context and not sure how to assign separate contexts to the jobs.

Thanks

@Sathya_B Hi. Did you find any solution? I have same problem like you