Hangfire – Multi tenant, ASP.NET Core – Resolving the correct tenant

First, you need to be able to set the TenantId in your TenantCurrentService. Then, you can rely on filters : client side (where you enqueue jobs) public class ClientTenantFilter : IClientFilter { public void OnCreating(CreatingContext filterContext) { if (filterContext == null) throw new ArgumentNullException(nameof(filterContext)); filterContext.SetJobParameter(“TenantId”, TenantCurrentService.TenantId); } } and server side (where the job is … Read more