コード例 #1
0
        public static ConfigHelperCommon GetCurrentSettings(string Key)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();

            IConfigurationRoot configuration = builder.Build();

            var settings = new ConfigHelperCommon(configuration.GetSection("AppSettings"), Key);

            return(settings);
        }
コード例 #2
0
 public static string AppSetting(string Key)
 {
     _appSettings = GetCurrentSettings(Key);
     return(_appSettings.appSettingValue);
 }