Example #1
0
        private IDbConnection GetConnection(DatabaseEngine providerType, string connectionString)
        {
            var provider = _connectionProviderFactory.GetInstance(providerType);
            var cn       = provider.GetCustomConnection(connectionString);

            return(cn);
        }
Example #2
0
        private void ExecuteScriptFile(DatabaseEngine serverType, string server, string file)
        {
            var scriptContent = File.ReadAllText(file);

            var provider = _connectionProviderFactory.GetInstance(serverType);

            using var cn = provider.GetConnectionFromParams(server);
            var cmd = cn.CreateCommand();

            cmd.CommandText = scriptContent;
            cmd.Connection  = cn;
            cn.ExecuteCommand(cmd);
        }