mirror of https://github.com/abpframework/abp.git
5 changed files with 81 additions and 4 deletions
@ -0,0 +1,33 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.Client |
|||
{ |
|||
public class RemoteSettingProvider : ISettingProvider, ITransientDependency |
|||
{ |
|||
protected ICachedApplicationConfigurationClient ConfigurationClient { get; } |
|||
|
|||
public RemoteSettingProvider(ICachedApplicationConfigurationClient configurationClient) |
|||
{ |
|||
ConfigurationClient = configurationClient; |
|||
} |
|||
|
|||
public async Task<string> GetOrNullAsync(string name) |
|||
{ |
|||
var configuration = await ConfigurationClient.GetAsync(); |
|||
return configuration.Setting.Values.GetOrDefault(name); |
|||
} |
|||
|
|||
public async Task<List<SettingValue>> GetAllAsync() |
|||
{ |
|||
var configuration = await ConfigurationClient.GetAsync(); |
|||
return configuration |
|||
.Setting.Values |
|||
.Select(s => new SettingValue(s.Key, s.Value)) |
|||
.ToList(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|||
{ |
|||
[Serializable] |
|||
public class ApplicationSettingConfigurationDto |
|||
{ |
|||
public Dictionary<string, string> Values { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue