/// <summary> /// Deploy the update /// </summary> public void DeployUpdate(IDataUpdate update, string connectionStringName, XmlDocument configurationDom) { string connectionString = configurationDom.SelectSingleNode(String.Format("//connectionStrings/add[@name='{0}']/@connectionString", connectionStringName)).Value; using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) { conn.Open(); var checkSql = update.GetCheckSql(this.InvariantName); if (!String.IsNullOrEmpty(checkSql)) { using (NpgsqlCommand cmd = new NpgsqlCommand(checkSql, conn)) if (!(bool)cmd.ExecuteScalar()) { return; } } var deplSql = update.GetDeploySql(this.InvariantName); if (!String.IsNullOrEmpty(deplSql)) { using (NpgsqlCommand cmd = new NpgsqlCommand(deplSql, conn)) cmd.ExecuteNonQuery(); } } }