| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | 
							- using Microsoft.Extensions.Configuration;
 
- using Microsoft.Extensions.Configuration.Memory;
 
- using MySqlX.XDevAPI;
 
- namespace OASystem.Infrastructure.Tools;
 
- /// <summary>
 
- /// 配置帮助类
 
- /// </summary>
 
- public class AppSettingsHelper
 
- {
 
-     static IConfiguration _config;
 
-     public AppSettingsHelper(IConfiguration configuration)
 
-     {
 
-         _config = configuration;
 
-     }
 
-     public static string Get(string key, bool IsConn = false)
 
-     {
 
-         string value;
 
-         try
 
-         {
 
-             if (key.IsNull()) return null;
 
-             if (IsConn)
 
-             {
 
-                 value = _config.GetConnectionString(key);
 
-             }
 
-             else
 
-             {
 
-                 value = _config[key];
 
-             }
 
-         }
 
-         catch (Exception)
 
-         {
 
-             value = null;
 
-         }
 
-         return value;
 
-     }
 
-     public static string Get(params string[] sessions)
 
-     {
 
-         try
 
-         {
 
-             if (sessions.Any())
 
-             {
 
-                 return _config[string.Join(":", sessions)];
 
-             }
 
-         }
 
-         catch
 
-         {
 
-             return null;
 
-         }
 
-         return null;
 
-     }
 
-     public static string Get(string key)
 
-     {
 
-         try
 
-         {
 
-             if (key.IsNull()) return null;
 
-             return _config[key];
 
-         }
 
-         catch
 
-         {
 
-             return null;
 
-         }
 
-     }
 
-     public static List<T> Get<T>(params string[] session)
 
-     {
 
-         var list = new List<T>();
 
-         _config.Bind(string.Join(":", session), list);
 
-         return list;
 
-     }
 
-     public static IConfigurationSection GetSection(string key)
 
-     {
 
-         try
 
-         {
 
-             return _config.GetSection(key);
 
-         }
 
-         catch
 
-         {
 
-             return null;
 
-         }
 
-     }
 
- }
 
 
  |