private DbConnection OpenConnection() { this.currentFactory = DbProviderFactories.GetFactory(SecurityConfig.GetInstance().SqlProvider); DbConnection connection = this.currentFactory.CreateConnection(); connection.ConnectionString = this.MountConnection(); connection.Open(); return(connection); }
public static void ConfigureInternalSecrets(this IApplicationBuilder app, IConfiguration config) { DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance); SecurityConfig.GetInstance() .AddSqlServer(config["SqlConnection:Server"]) .AddSqlUID(config["SqlConnection:uid"]) .AddSqlPWD(config["SqlConnection:pwd"]) .AddSqlDatabase(config["SqlConnection:database"]) .AddSqlTimeout(config["SqlConnection:timeout"]) .AddSqlProvider(config["SqlConnection:provider"]); }
private string MountConnection() { StringBuilder b = new StringBuilder(); b.Append($@"Data Source={SecurityConfig.GetInstance().SqlServer};"); b.Append($@"Initial Catalog={SecurityConfig.GetInstance().SqlDatabase};"); b.Append($@"User ID={SecurityConfig.GetInstance().SqlUID};"); b.Append($@"Password={SecurityConfig.GetInstance().SqlPWD};"); b.Append($@"Persist Security Info={true};"); b.Append($@"Connect Timeout={SecurityConfig.GetInstance().SqlTimeout};"); return(b.ToString()); }
public void GetConnectionConfig() { SecurityConfig c = SecurityConfig.GetInstance(); }
public IActionResult GetConnectionString() { return(this.WriteSucess(SecurityConfig.GetInstance())); }
public SecurityConfig GetConnectionString() { return(SecurityConfig.GetInstance()); }