Base solution for your next web application
Open Closed

How To Query in Hangfire not pointing in the base DB in MultiTenant ANZ #8946


User avatar
0
jur.porras created

I am using the multitenancy feature of the framework. Each tenant has its own database. The problem is, When I run query in my Hangfire Job class, It always getting data from the base database.

By the way, I am require to use unitofwork in able to fetch data without conflict with the tenant.

Example code below:

using (var unitOfWork = _unitOfWorkManager.Begin()) { _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant, AbpDataFilters.MustHaveTenant);...

            ...

Queries outside of that unitofwork will not work because of tenant conlict errors. Though I am able to get data now in my Hangfire Job class, the data came from the base or parent database not in my subtenant database.

Can someone help?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)