SettingStore.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections.Generic;
  2. using System.Configuration;
  3. using System.Threading.Tasks;
  4. using Abp.Configuration;
  5. using Abp.Threading;
  6. namespace IwbZero.Setting
  7. {
  8. public class IwbSettingStore : ISettingStore
  9. {
  10. /// <summary>
  11. /// Gets singleton instance.
  12. /// </summary>
  13. public static IwbSettingStore Instance { get; } = new IwbSettingStore();
  14. private IwbSettingStore()
  15. {
  16. }
  17. public Task<SettingInfo> GetSettingOrNullAsync(int? tenantId, long? userId, string name)
  18. {
  19. //throw new NotImplementedException();
  20. var value = ConfigurationManager.AppSettings[name];
  21. if (value == null)
  22. {
  23. return Task.FromResult<SettingInfo>(null);
  24. }
  25. return Task.FromResult(new SettingInfo(tenantId, userId, name, value));
  26. }
  27. public Task DeleteAsync(SettingInfo setting)
  28. {
  29. //throw new NotImplementedException();
  30. return AbpTaskCache.CompletedTask;
  31. }
  32. public Task CreateAsync(SettingInfo setting)
  33. {
  34. //throw new NotImplementedException();
  35. return AbpTaskCache.CompletedTask;
  36. }
  37. public Task UpdateAsync(SettingInfo setting)
  38. {
  39. //throw new NotImplementedException();
  40. return AbpTaskCache.CompletedTask;
  41. }
  42. public Task<List<SettingInfo>> GetAllListAsync(int? tenantId, long? userId)
  43. {
  44. //throw new NotImplementedException();
  45. return Task.FromResult(new List<SettingInfo>());
  46. }
  47. }
  48. }