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.

37 lines
1.4 KiB
C#

using Microsoft.Extensions.Configuration;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Settings;
namespace NPin.Framework.SettingManagement.Domain.Provider;
public class ConfigurationSettingManagementProvider: ISettingManagementProvider, ITransientDependency
{
public string Name => ConfigurationSettingValueProvider.ProviderName;
protected IConfiguration Configuration { get; }
public ConfigurationSettingManagementProvider(IConfiguration configuration)
{
Configuration = configuration;
}
public virtual Task<string?> GetOrNullAsync(SettingDefinition setting, string providerKey)
{
return Task.FromResult(Configuration[ConfigurationSettingValueProvider.ConfigurationNamePrefix + setting.Name]);
}
public Task<List<SettingValue>> GetByPrefixAsync(string prefix, string? providerKey)
{
throw new AbpException($"Can not get a setting value by prefix to the application configuration.");
}
public Task SetAsync(SettingDefinition setting, string value, string providerKey)
{
throw new AbpException($"Can not set a setting value to the application configuration.");
}
public Task ClearAsync(SettingDefinition setting, string providerKey)
{
throw new AbpException($"Can not clear provider to the application configuration.");
}
}