0
ajayak created
Hi,
I have a background job where I fetch a setting value for each tenant. Is there a way by which I can fetch the setting value for all tenants in 1 query instead of foreach?
Current code:
var tenantIds = await _lRepository.GetAll().IgnoreQueryFilters()
.Select(c => c.TenantId)
.ToListAsync();
foreach (var tenantId in tenantIds)
{
var myBoolFlag = await SettingManager.GetSettingValueForTenantAsync<bool>("Super Power", tenantId);
if (!myBoolFlag) continue;
// Other code
}
1 Answer(s)
-
0
Hi, you can query directly from setting repository.
IRepository<Setting, long> settingRepository;