Пример #1
0
        public DataCompare(ComparisonSource left, ComparisonSource right)
        {
            this.Left  = left;
            this.Right = right;

            this.LeftConnection  = ConnectionFactory.CreateConnection(this.Left);
            this.RightConnection = ConnectionFactory.CreateConnection(this.Right);

            LeftCommand             = this.LeftConnection.CreateCommand();
            LeftCommand.CommandText = Left.Sql;

            RightCommand             = this.RightConnection.CreateCommand();
            RightCommand.CommandText = Right.Sql;
        }
Пример #2
0
        public static DbConnection CreateConnection(ComparisonSource source)
        {
            DbConnection connection = null;

            switch (source.SqlProvider)
            {
            case "MySql":
                connection = new MySqlConnection(source.ConnectionString);
                break;

            case "SqlServer":
                connection = new SqlConnection(source.ConnectionString);
                break;

            default:
                throw new NotImplementedException(source.SqlProvider);
            }

            return(connection);
        }