You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
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
|
|
};
|
|
}
|
|
}
|
|
}
|