AppConfigItem.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Azylee.Core.AppUtils.AppConfigUtils.AppConfigInterfaces;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace Azylee.Core.AppUtils.AppConfigUtils.AppConfigModels
  7. {
  8. public class AppConfigItem : IAppConfigItemModel
  9. {
  10. public int Number { get; set; }
  11. public string Name { get; set; }
  12. public Dictionary<string, string> Datas { get; set; }
  13. public AppConfigItem()
  14. {
  15. this.Datas = new Dictionary<string, string>();
  16. }
  17. public string GetValue(string key, string defaultValue = "")
  18. {
  19. if (Datas.TryGetValue(key, out string value))
  20. {
  21. return value;
  22. }
  23. return defaultValue;
  24. }
  25. public void SetValue(string key, string value)
  26. {
  27. if (Datas.ContainsKey(key))
  28. {
  29. Datas[key] = value;
  30. }
  31. else
  32. {
  33. Datas.Add(key, value);
  34. }
  35. }
  36. public int GetOrderNumber()
  37. {
  38. return this.Number;
  39. }
  40. public string GetUniqueName()
  41. {
  42. return this.Name;
  43. }
  44. }
  45. }