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; }
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); }