You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
|
using Volo.Abp.Settings;
|
|
|
|
|
|
|
|
|
|
namespace NPin.Framework.SettingManagement.Domain;
|
|
|
|
|
|
|
|
|
|
public class DefaultValueSettingManagementProvider : ISettingManagementProvider, ISingletonDependency
|
|
|
|
|
{
|
|
|
|
|
public string Name => DefaultValueSettingValueProvider.ProviderName;
|
|
|
|
|
|
|
|
|
|
public virtual Task<string?> GetOrNullAsync(SettingDefinition setting, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
return Task.FromResult(setting.DefaultValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task SetAsync(SettingDefinition setting, string value, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
throw new AbpException(
|
|
|
|
|
$"Can not set default value of a setting. It is only possible while defining the setting in a {typeof(ISettingDefinitionProvider)} implementation.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task ClearAsync(SettingDefinition setting, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
throw new AbpException(
|
|
|
|
|
$"Can not clear default value of a setting. It is only possible while defining the setting in a {typeof(ISettingDefinitionProvider)} implementation.");
|
|
|
|
|
}
|
|
|
|
|
}
|