string ChangeTable(XElement actionElement) { List <XElement> addedColumns = actionElement.Elements("AddColumn").ToList(); List <XElement> removedColumns = actionElement.Elements("DropColumn").ToList(); List <XElement> changedColumns = actionElement.Elements("AlterColumn").ToList(); if (addedColumns.Count == 0 && removedColumns.Count == 0 && changedColumns.Count == 0) { return(String.Empty); } StringBuilder sb = new StringBuilder(); string rawTableName = actionElement.Attribute("name").Value; string tableName = this.provider.GetQualifiedTableName(rawTableName); string alterString = "ALTER TABLE " + tableName + ' '; foreach (XElement columnElement in addedColumns) { sb.Append(alterString); sb.Append(concreteGenerator.AddColumn()); sb.Append(' '); sb.Append(CreateColumn(columnElement, GetClassForTable(rawTableName, this.mappings), this.provider, false)); sb.Append(";\n"); } foreach (XElement columnElement in removedColumns) { sb.Append(alterString); sb.Append(concreteGenerator.RemoveColumn(provider.GetQuotedName(columnElement.Attribute("name").Value))); sb.Append(";\n"); } foreach (XElement columnElement in changedColumns) { sb.Append(alterString); sb.Append(concreteGenerator.AlterColumnType()); sb.Append(' '); sb.Append(CreateColumn(columnElement, GetClassForTable(rawTableName, this.mappings), this.provider, false)); sb.Append(";\n"); } return(sb.ToString()); }