|
|
|
@ -0,0 +1,41 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Volo.Abp.MultiTenancy;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.Settings
|
|
|
|
|
{
|
|
|
|
|
public static class TenantSettingManagerExtensions
|
|
|
|
|
{
|
|
|
|
|
public static Task<string> GetOrNullForTenantAsync(this ISettingManager settingManager, [NotNull] string name, Guid tenantId, bool fallback = true)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.GetOrNullAsync(name, TenantSettingValueProvider.ProviderName, tenantId.ToString(), fallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Task<string> GetOrNullForCurrentTenantAsync(this ISettingManager settingManager, [NotNull] string name, bool fallback = true)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.GetOrNullAsync(name, TenantSettingValueProvider.ProviderName, null, fallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Task<List<SettingValue>> GetAllForTenantAsync(this ISettingManager settingManager, Guid tenantId, bool fallback = true)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.GetAllAsync(TenantSettingValueProvider.ProviderName, tenantId.ToString(), fallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Task<List<SettingValue>> GetAllForCurrentTenantAsync(this ISettingManager settingManager, bool fallback = true)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.GetAllAsync(TenantSettingValueProvider.ProviderName, null, fallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Task SetForTenantAsync(this ISettingManager settingManager, Guid tenantId, [NotNull] string name, [CanBeNull] string value, bool forceToSet = false)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.SetAsync(name, value, TenantSettingValueProvider.ProviderName, tenantId.ToString(), forceToSet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Task SetForCurrentTenantAsync(this ISettingManager settingManager, [NotNull] string name, [CanBeNull] string value, bool forceToSet = false)
|
|
|
|
|
{
|
|
|
|
|
return settingManager.SetAsync(name, value, TenantSettingValueProvider.ProviderName, null, forceToSet);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|