Example #1
0
        private DbConnection OpenConnection()
        {
            this.currentFactory = DbProviderFactories.GetFactory(SecurityConfig.GetInstance().SqlProvider);
            DbConnection connection = this.currentFactory.CreateConnection();

            connection.ConnectionString = this.MountConnection();
            connection.Open();
            return(connection);
        }
Example #2
0
        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"]);
        }
Example #3
0
        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());
        }
Example #4
0
 public void GetConnectionConfig()
 {
     SecurityConfig c = SecurityConfig.GetInstance();
 }
Example #5
0
 public IActionResult GetConnectionString()
 {
     return(this.WriteSucess(SecurityConfig.GetInstance()));
 }
Example #6
0
 public SecurityConfig GetConnectionString()
 {
     return(SecurityConfig.GetInstance());
 }