本文整理汇总了C#中FluentMigrator.Expressions.CreateColumnExpression类的典型用法代码示例。如果您正苦于以下问题:C# CreateColumnExpression类的具体用法?C# CreateColumnExpression怎么用?C# CreateColumnExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CreateColumnExpression类属于FluentMigrator.Expressions命名空间,在下文中一共展示了CreateColumnExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Generate
public override string Generate(CreateColumnExpression expression)
{
string errors = ValidateAdditionalFeatureCompatibility(expression.Column.AdditionalFeatures);
if (!string.IsNullOrEmpty(errors)) return errors;
return String.Format(AddColumn, Quoter.QuoteTableName(expression.TableName), Column.Generate(expression.Column));
}
开发者ID:RenaldSB,项目名称:fluentmigrator,代码行数:7,代码来源:GenericGenerator.cs
示例2: ReverseSetsTableNameAndColumnNameOnGeneratedExpression
public void ReverseSetsTableNameAndColumnNameOnGeneratedExpression()
{
var expression = new CreateColumnExpression { TableName = "Bacon", Column = { Name = "BaconId" } };
var reverse = expression.Reverse() as DeleteColumnExpression;
reverse.TableName.ShouldBe("Bacon");
reverse.ColumnName.ShouldBe("BaconId");
}
开发者ID:ngbrown,项目名称:fluentmigrator,代码行数:7,代码来源:CreateColumnExpressionTests.cs
示例3: CanUseSystemMethodCurrentDateTimeAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentDateTimeAsADefaultValueForAColumn()
{
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 15, Type = null, CustomType = "TIMESTAMP", DefaultValue = SystemMethods.CurrentDateTime };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = "NewTable" };
var result = Generator.Generate(expression);
result.ShouldBe("ALTER TABLE `NewTable` ADD COLUMN `NewColumn` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
}
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:8,代码来源:MySqlGeneratorTests.cs
示例4: CanAddColumnWithGetDateDefault
public void CanAddColumnWithGetDateDefault()
{
ColumnDefinition column = new ColumnDefinition { Name = "TestColumn1", Type = DbType.String,
Size = 5, DefaultValue = "GetDate()" };
var expression = new CreateColumnExpression { TableName = "TestTable1", Column = column };
var sql = _generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [TestTable1] ADD [TestColumn1] NVARCHAR(5) NOT NULL DEFAULT GetDate()");
}
开发者ID:remids,项目名称:fluentmigrator,代码行数:8,代码来源:SqlServer2000AlterTableTests.cs
示例5: CreateColumnGenerator
public dynamic CreateColumnGenerator(CreateColumnMigration createColumnMigration)
{
var column_migration_expr = new CreateColumnExpression
{
Column = build_column_definition(createColumnMigration)
};
return column_migration_expr;
}
开发者ID:jcteague,项目名称:SchemaMigrator,代码行数:9,代码来源:FluentMigratorMigrationFactory.cs
示例6: CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 5, Type = DbType.String, DefaultValue = SystemMethods.CurrentUTCDateTime };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
var result = Generator.Generate(expression);
result.ShouldBe("ALTER TABLE NewTable ADD COLUMN NewColumn VARGRAPHIC(5) CCSID 1200 NOT NULL DEFAULT (CURRENT_TIMESTAMP - CURRENT_TIMEZONE)");
}
开发者ID:BhuvanB,项目名称:fluentmigrator,代码行数:9,代码来源:Db2GeneratorTests.cs
示例7: CanUseSystemMethodCurrentUserAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUserAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 18, Type = DbType.AnsiString, DefaultValue = SystemMethods.CurrentUser };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
var result = Generator.Generate(expression);
result.ShouldBe("ALTER TABLE NewTable ADD COLUMN NewColumn VARCHAR(18) NOT NULL DEFAULT USER");
}
开发者ID:BhuvanB,项目名称:fluentmigrator,代码行数:9,代码来源:Db2GeneratorTests.cs
示例8: CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 5, Type = DbType.String, DefaultValue = SystemMethods.CurrentUTCDateTime };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
var result = Generator.Generate(expression);
result.ShouldBe("ALTER TABLE \"public\".\"NewTable\" ADD \"NewColumn\" varchar(5) NOT NULL DEFAULT (now() at time zone 'UTC')");
}
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:9,代码来源:PostgresGeneratorTests.cs
示例9: CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 5, Type = DbType.String, DefaultValue = SystemMethods.CurrentUTCDateTime };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
var result = Generator.Generate(expression);
result.ShouldBe("ALTER TABLE \"NewTable\" ADD (\"NewColumn\" NVARCHAR(5) DEFAULT CURRENT_UTCTIMESTAMP);");
}
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:10,代码来源:HanaGeneratorTests.cs
示例10: CanAddDecimalColumn
public void CanAddDecimalColumn()
{
var tableName = "NewTable";
var columnDefinition = new ColumnDefinition {Name = "NewColumn", Size = 19, Precision = 2, Type = DbType.Decimal};
var expression = new CreateColumnExpression {Column = columnDefinition, TableName = tableName};
ApplyDefaultConventions(expression);
var sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [NewTable] ADD COLUMN NewColumn NUMERIC NOT NULL");
}
开发者ID:jetheredge,项目名称:fluentmigrator,代码行数:10,代码来源:SqliteGeneratorWithConventionsAppliedTests.cs
示例11: CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUTCDateTimeAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Type = DbType.DateTime, DefaultValue = SystemMethods.CurrentUTCDateTime };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [dbo].[NewTable] ADD [NewColumn] DATETIME NOT NULL CONSTRAINT DF__NewColumn DEFAULT GETUTCDATE()");
}
开发者ID:kevjett,项目名称:fluentmigrator,代码行数:11,代码来源:SqlServer2005GeneratorTests.cs
示例12: CanUseSystemMethodCurrentUserAsADefaultValueForAColumn
public void CanUseSystemMethodCurrentUserAsADefaultValueForAColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition { Name = "NewColumn", Size = 15, Type = DbType.String, DefaultValue = SystemMethods.CurrentUser };
var expression = new CreateColumnExpression { Column = columnDefinition, TableName = tableName };
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [dbo].[NewTable] ADD [NewColumn] NVARCHAR(15) NOT NULL CONSTRAINT DF__NewColumn DEFAULT CURRENT_USER");
}
开发者ID:kevjett,项目名称:fluentmigrator,代码行数:11,代码来源:SqlServer2005GeneratorTests.cs
示例13: Generate
public override string Generate(CreateColumnExpression expression)
{
var createStatement = new StringBuilder();
createStatement.Append(string.Format("ALTER TABLE {0}.{1} ADD {2}", Quoter.QuoteSchemaName(expression.SchemaName), Quoter.QuoteTableName(expression.TableName), Column.Generate(expression.Column)));
var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression);
if (!string.IsNullOrEmpty(descriptionStatement))
{
createStatement.Append(";");
createStatement.Append(descriptionStatement);
}
return createStatement.ToString();
}
开发者ID:akema-fr,项目名称:fluentmigrator,代码行数:12,代码来源:PostgresGenerator.cs
示例14: CanAddDecimalColumn
public void CanAddDecimalColumn()
{
const string tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 19;
columnDefinition.Precision = 2;
columnDefinition.Type = DbType.Decimal;
var expression = new CreateColumnExpression {Column = columnDefinition, TableName = tableName};
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE \"public\".\"NewTable\" ADD \"NewColumn\" decimal(19,2) NOT NULL");
}
开发者ID:reharik,项目名称:fluentmigrator,代码行数:15,代码来源:PostgresGeneratorTests.cs
示例15: CanAddIdentityColumn
public void CanAddIdentityColumn()
{
string tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "id";
columnDefinition.IsIdentity=true;
columnDefinition.Type = DbType.Int32;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE \"public\".\"NewTable\" ADD \"id\" serial NOT NULL");
}
开发者ID:timscott,项目名称:fluentmigrator,代码行数:16,代码来源:PostgresGeneratorTests.cs
示例16: CanAddColumn
public void CanAddColumn()
{
string tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 5;
columnDefinition.Type = DbType.String;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE \"public\".\"NewTable\" ADD \"NewColumn\" varchar(5) NOT NULL");
}
开发者ID:timscott,项目名称:fluentmigrator,代码行数:16,代码来源:PostgresGeneratorTests.cs
示例17: CanAddColumn
public void CanAddColumn()
{
var tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 5;
columnDefinition.Type = DbType.String;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
var sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [NewTable] ADD NewColumn NVARCHAR(5) NOT NULL");
}
开发者ID:Andrea,项目名称:fluentmigrator,代码行数:16,代码来源:SqlServerGeneratorTests.cs
示例18: CanAddDecimalColumn
public void CanAddDecimalColumn()
{
string tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 5;
columnDefinition.Precision = 2;
columnDefinition.Type = DbType.Decimal;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE \"NewTable\" ADD \"NewColumn\" DECIMAL(2,5) NOT NULL");
}
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:17,代码来源:FirebirdGeneratorTests.cs
示例19: CanAddDecimalColumn
public void CanAddDecimalColumn()
{
var tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 19;
columnDefinition.Precision = 2;
columnDefinition.Type = DbType.Decimal;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
var sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [NewTable] ADD NewColumn DECIMAL(19,2) NOT NULL");
}
开发者ID:Andrea,项目名称:fluentmigrator,代码行数:17,代码来源:SqlServerGeneratorTests.cs
示例20: CanAddDecimalColumn
public void CanAddDecimalColumn()
{
string tableName = "NewTable";
var columnDefinition = new ColumnDefinition();
columnDefinition.Name = "NewColumn";
columnDefinition.Size = 19;
columnDefinition.Precision = 2;
columnDefinition.Type = DbType.Decimal;
var expression = new CreateColumnExpression();
expression.Column = columnDefinition;
expression.TableName = tableName;
string sql = generator.Generate(expression);
sql.ShouldBe("ALTER TABLE [NewTable] ADD COLUMN NewColumn NUMERIC NOT NULL");
}
开发者ID:Ang3lFir3,项目名称:fluentmigrator,代码行数:17,代码来源:SqliteGeneratorTests.cs
注:本文中的FluentMigrator.Expressions.CreateColumnExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论