public void ErrorIsNotReturnedWhenTableNameIsSet() { var expression = new AlterTableExpression { TableName = "table1" }; var errors = ValidationHelper.CollectErrors(expression); Assert.That(errors.Count, Is.EqualTo(0)); }
public void ErrorIsReturnedWhenTableNameIsEmptyString() { var expression = new AlterTableExpression { TableName = String.Empty }; var errors = ValidationHelper.CollectErrors(expression); errors.ShouldContain(ErrorMessages.TableNameCannotBeNullOrEmpty); }
public override string Generate(AlterTableExpression expression) { var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression); if (string.IsNullOrEmpty(descriptionStatement)) return base.Generate(expression); return descriptionStatement; }
public override string Generate(AlterTableExpression expression) { var alterStatement = new StringBuilder(); var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression); alterStatement.Append(base.Generate(expression)); if (string.IsNullOrEmpty(descriptionStatement)) { alterStatement.Append(descriptionStatement); } return alterStatement.ToString(); }
public override string GenerateDescriptionStatement(AlterTableExpression expression) { if (string.IsNullOrEmpty(expression.TableDescription)) return string.Empty; var formattedSchemaName = FormatSchemaName(expression.SchemaName); // For this, we need to remove the extended property first if exists (or implement verification and use sp_updateextendedproperty) var tableVerificationStatement = string.Format(TableDescriptionVerificationTemplate, formattedSchemaName, expression.TableName); var removalStatement = string.Format("{0} {1}", tableVerificationStatement, GenerateTableDescriptionRemoval(formattedSchemaName, expression.TableName)); var newDescriptionStatement = GenerateTableDescription(formattedSchemaName, expression.TableName, expression.TableDescription); return string.Join(";", new[] { removalStatement, newDescriptionStatement }); }
public IAlterTableAddColumnOrAlterColumnOrSchemaOrDescriptionSyntax Table(string tableName) { var expression = new AlterTableExpression { TableName = tableName }; _context.Expressions.Add(expression); return new AlterTableExpressionBuilder(expression, _context); }
public virtual void Process(AlterTableExpression expression) { Process(Generator.Generate(expression)); }
public void Truncate(AlterTableExpression expression) { expression.TableName = Truncate(expression.TableName); }
public string Generate(AlterTableExpression expression) { // returns nothing because the individual AddColumn and AlterColumn calls // create CreateColumnExpression and AlterColumnExpression respectively return string.Empty; }
public string GenerateDescriptionStatement(AlterTableExpression expression) { return string.Empty; }
public override string Generate(AlterTableExpression expression) { var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression); return string.Format("{0};", string.IsNullOrEmpty(descriptionStatement) ? base.Generate(expression) : descriptionStatement);; }