using System; using System.Collections.Generic; using System.Text; using Microsoft.Extensions.Configuration; namespace Common.Library.Settings { public static class SettingsLoader { public static IConfiguration Configuration { get; set; } #region DB public static string DBName { get => Configuration?.GetSection("Database")["DBName"]; } public static string DBHost { get => Configuration?.GetSection("Database")["Host"]; } public static string DBUserName { get => Configuration?.GetSection("Database")["UserName"]; } public static string DBPassword { get => Configuration?.GetSection("Database")["Password"]; } #endregion public static SQL.Base.SQLBase.DBConnectionInformation GetDBConnectionInformation(IConfiguration configuration, SQL.Base.SQLBase.DBType dbType) { return new() { DBName = configuration?.GetSection("Database")["DBName"], DBHost = configuration?.GetSection("Database")["Host"], DBUserName = configuration?.GetSection("Database")["UserName"], DBPassword = configuration?.GetSection("Database")["Password"], DBType = dbType }; } } }