protected override Expression VisitForeignKeyConstraint(SqlForeignKeyConstraintExpression foreignKeyConstraintExpression) { var action = new SqlConstraintActionExpression(SqlConstraintActionType.Add, foreignKeyConstraintExpression); var ammendmentEpression = new SqlAlterTableExpression(currentTable.Table, action); ammendments.Add(ammendmentEpression); return null; }
protected virtual Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression) { var newTable = this.Visit(alterTableExpression.Table); var newList = this.VisitExpressionList(alterTableExpression.Actions); if (newTable != alterTableExpression.Table || newList != alterTableExpression.Actions) { return(new SqlAlterTableExpression(newTable, newList)); } return(alterTableExpression); }
protected override Expression VisitAlterTable(SqlAlterTableExpression expression) { SqlAlterTableExpression current; if (!TryGetCurrent(expression, out current)) { return expression; } if (!(this.result &= current.NodeType == expression.NodeType)) { return expression; } if (!(this.result &= current.Type == expression.Type)) { return expression; } this.currentObject = current.Table; this.Visit(expression.Table); if (!this.result) { return expression; } this.currentObject = current.Actions; this.VisitExpressionList(expression.Actions); if (!this.result) { return expression; } this.currentObject = current.ConstraintActions; this.VisitExpressionList(expression.ConstraintActions); if (!this.result) { return expression; } this.currentObject = current; return expression; }
protected override Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression) { this.Write("ALTER TABLE "); this.Visit(alterTableExpression.Table); this.Write(" "); this.VisitExpressionList(alterTableExpression.Actions); this.WriteLine(";"); return alterTableExpression; }
protected virtual Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression) { var newTable = this.Visit(alterTableExpression.Table); var newList = this.VisitExpressionList(alterTableExpression.Actions); if (newTable != alterTableExpression.Table || newList != alterTableExpression.Actions) { return new SqlAlterTableExpression(newTable, newList); } return alterTableExpression; }
protected override Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression) { this.Write("ALTER TABLE "); this.Visit(alterTableExpression.Table); this.Write(" "); if (alterTableExpression.ConstraintActions != null) { this.VisitExpressionList(alterTableExpression.ConstraintActions); } else if (alterTableExpression.Actions != null) { foreach (var action in alterTableExpression.Actions) { this.Visit(action); } } this.WriteLine(";"); return alterTableExpression; }