0
leonkosak created
MyPeriodicBackgroundMethod()
{
var tenantIdList = new List<int>(); //all **tenants** which have **dedicated database**
foreach (var tenantId in tenantIdList)
{
using (_unitOfWorkManager.Current.SetTenantId(tenantId)
{
//code for specific tenant - inserts, updates, deletes in this tenant database
}
}
}
Is somehow possible and safe make foreach loop parallel (TPL - Parallel.ForEach) or not in such background job or worker? Thank you for explanations.