private static ReadConfig GetCurrentSettings(string section, string key) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); builder.AddEnvironmentVariables(); IConfigurationRoot configuration = builder.Build(); var settings = new ReadConfig(configuration.GetSection(section), key); return(settings); }
public static string ConnectionString(string key) { _appSettings = GetCurrentSettings("ConnectionStrings", key); return(_appSettings.appSettingValue); }