public void CreateConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     using (DbCommand command = commandCreator()) {
         command.CommandText = _SQLQueryManager.CreateConstraint(constraint);
         ExecuteNonQuery(command);
     }
 }
 /// <summary>
 /// SQL-92, page 292
 /// </summary>
 private string _DropTableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "DROP CONSTRAINT {0}",
                nameEscaper(constraint.name)
                ));
 }
 /// <summary>
 /// SQL-92, page 291
 /// </summary>
 private string _AddTableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "ADD {0}",
                _TableConstraintDefinition(constraint)
                ));
 }
 /// <summary>
 /// SQL-92, page 252
 /// </summary>
 private string _ConstraintNameDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "CONSTRAINT {0}",
                nameEscaper(constraint.name)
                ));
 }
 public void RemoveConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     CheckConstraint(commandCreator, constraint);
     using (DbCommand command = commandCreator()) {
         command.CommandText = _SQLQueryManager.DropConstraint(constraint);
         ExecuteNonQuery(command);
     }
 }
 /// <summary>
 /// SQL-92, page 270
 /// </summary>
 private string _TableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "{0} {1}",
                _ConstraintNameDefinition(constraint),
                _TableConstraint(constraint)
                ));
 }
 private void CheckConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     constraint.Accept(fkc => CheckConstraint(commandCreator, fkc), uc => CheckConstraint(commandCreator, uc), cc => CheckConstraint(commandCreator, cc));
 }
 public string DropConstraint(AbstractConstraint constraint)
 {
     return(_AlterTableStatement(constraint.table, _DropTableConstraintDefinition(constraint)));
 }
 /// <summary>
 /// SQL-92, page 270
 /// </summary>
 private string _TableConstraint(AbstractConstraint constraint)
 {
     return(constraint.Accept <string>(_ReferentialConstraintDefinition, _UniqueConstraintDefinition, _CheckConstraintDefinition));
 }
Exemple #10
0
 public void RemoveConstraint(AbstractConstraint constraint)
 {
     this.traits.RemoveConstraint(this.CreateTextCommand, constraint);
 }