当前位置: 首页>>代码示例>>C#>>正文


C# Expressions.AlterColumnExpression类代码示例

本文整理汇总了C#中FluentMigrator.Expressions.AlterColumnExpression的典型用法代码示例。如果您正苦于以下问题:C# AlterColumnExpression类的具体用法?C# AlterColumnExpression怎么用?C# AlterColumnExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AlterColumnExpression类属于FluentMigrator.Expressions命名空间,在下文中一共展示了AlterColumnExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanAlterColumn

 public void CanAlterColumn()
 {
     var expression = new AlterColumnExpression
                          {
                              Column = new ColumnDefinition { Type = DbType.String, Name = "Col1" },
                              SchemaName = "Schema1",
                              TableName = "Table1"
                          };
     var sql = generator.Generate(expression);
     sql.ShouldBe(String.Empty);
 }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:11,代码来源:FirebirdGeneratorTests.cs

示例2: Generate

 public override string Generate(AlterColumnExpression expression)
 {
     var alterStatement = new StringBuilder();
     alterStatement.Append(String.Format("ALTER TABLE {0}.{1} {2}", Quoter.QuoteSchemaName(expression.SchemaName), Quoter.QuoteTableName(expression.TableName), ((PostgresColumn)Column).GenerateAlterClauses(expression.Column)));
     var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression);
     if (!string.IsNullOrEmpty(descriptionStatement))
     {
         alterStatement.Append(";");
         alterStatement.Append(descriptionStatement);
     }
     return alterStatement.ToString();
 }
开发者ID:akema-fr,项目名称:fluentmigrator,代码行数:12,代码来源:PostgresGenerator.cs

示例3: GetAlterColumnExpression

        public static AlterColumnExpression GetAlterColumnExpression()
        {
            var expression = new AlterColumnExpression();
            expression.TableName = TestTableName1;

            expression.Column = new ColumnDefinition();
            expression.Column.Name = TestColumnName1;
            expression.Column.Type = DbType.String;
            expression.Column.Size = 20;
            expression.Column.IsNullable = false;

            return expression;
        }
开发者ID:rmmason,项目名称:fluentmigrator,代码行数:13,代码来源:GeneratorTestHelper.cs

示例4: GenerateDescriptionStatement

        public override string GenerateDescriptionStatement(AlterColumnExpression expression)
        {
            if (string.IsNullOrEmpty(expression.Column.ColumnDescription))
                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 columnVerificationStatement = string.Format(ColumnDescriptionVerificationTemplate, formattedSchemaName, expression.TableName, expression.Column.Name);
            var removalStatement = string.Format("{0} {1}", columnVerificationStatement, GenerateColumnDescriptionRemoval(formattedSchemaName, expression.TableName, expression.Column.Name));
            var newDescriptionStatement = GenerateColumnDescription(formattedSchemaName, expression.TableName, expression.Column.Name, expression.Column.ColumnDescription);

            return string.Join(";", new[] { removalStatement, newDescriptionStatement });
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:14,代码来源:SqlServer2005DescriptionGenerator.cs

示例5: Process

        public override void Process(AlterColumnExpression expression)
        {
            var tableDefinition = GetTableSchema(expression.TableName);

            var columnDefinitions = tableDefinition.Columns.ToList();
            var columnIndex = columnDefinitions.FindIndex(c => c.Name == expression.Column.Name);

            if (columnIndex == -1)
            {
                throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", expression.Column.Name, expression.TableName));
            }

            columnDefinitions[columnIndex] = expression.Column;

            tableDefinition.Columns = columnDefinitions;

            ProcessAlterTable(tableDefinition);
        }
开发者ID:Djohnnie,项目名称:Sonarr,代码行数:18,代码来源:NzbDroneSqliteProcessor.cs

示例6: Process

 public virtual void Process(AlterColumnExpression expression)
 {
     Process(Generator.Generate(expression));
 }
开发者ID:Ang3lFir3,项目名称:fluentmigrator,代码行数:4,代码来源:ProcessorBase.cs

示例7: Generate

 public override string Generate(AlterColumnExpression expression)
 {
     return string.Format("ALTER TABLE {0}", base.Generate(expression));
 }
开发者ID:rebootd,项目名称:fluentmigrator,代码行数:4,代码来源:SqlServerCeGenerator.cs

示例8: Truncate

 public void Truncate(AlterColumnExpression expression)
 {
     expression.TableName = Truncate(expression.TableName);
     Truncate(expression.Column);
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:5,代码来源:FirebirdTruncator.cs

示例9: CanAlterColumn

 public void CanAlterColumn()
 {
     var expression = new AlterColumnExpression
                          {
                              Column = new ColumnDefinition {Type = DbType.String, Name = "Col1"},
                              SchemaName = "Schema1",
                              TableName = "Table1"
                          };
     var sql = generator.Generate(expression);
     sql.ShouldBe("ALTER TABLE \"Schema1\".\"Table1\" ALTER \"Col1\" TYPE text");
 }
开发者ID:timscott,项目名称:fluentmigrator,代码行数:11,代码来源:PostgresGeneratorTests.cs

示例10: ToStringIsDescriptive

 public void ToStringIsDescriptive()
 {
     var expression = new AlterColumnExpression { TableName = "Bacon", Column = { Name = "BaconId", Type = DbType.Int32 } };
     expression.ToString().ShouldBe("AlterColumn Bacon BaconId Int32");
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:5,代码来源:AlterColumnExpressionTests.cs

示例11: Generate

        public override string Generate(AlterColumnExpression expression)
        {
            var descriptionStatement = DescriptionGenerator.GenerateDescriptionStatement(expression);

            if (string.IsNullOrEmpty(descriptionStatement))
                return base.Generate(expression);

            var wrappedAlterColumnStatement = WrapStatementInExecuteImmediateBlock(base.Generate(expression));

            var alterColumnWithDescriptionBuilder = new StringBuilder(wrappedAlterColumnStatement);
            alterColumnWithDescriptionBuilder.Append(WrapStatementInExecuteImmediateBlock(descriptionStatement));

            return WrapInBlock(alterColumnWithDescriptionBuilder.ToString());
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:14,代码来源:OracleGenerator.cs

示例12: Generate

 public override string Generate(AlterColumnExpression expression)
 {
     throw new NotImplementedException();
 }
开发者ID:paulbatum,项目名称:fluentmigrator,代码行数:4,代码来源:SqliteGenerator.cs

示例13: CanAlterColumnAndSetAsNullable

        public void CanAlterColumnAndSetAsNullable()
        {
            var expression = new AlterColumnExpression
            {
                Column = new ColumnDefinition { Type = DbType.String, Name = "TestColumn1", IsNullable = true },
                SchemaName = "TestSchema",
                TableName = "TestTable1"
            };

            var result = Generator.Generate(expression);
            result.ShouldBe("ALTER TABLE \"TestSchema\".\"TestTable1\" ALTER \"TestColumn1\" TYPE text, ALTER \"TestColumn1\" DROP NOT NULL");
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:12,代码来源:PostgresGeneratorTests.cs

示例14: Generate

 public override string Generate(AlterColumnExpression expression)
 {
     return compatabilityMode.HandleCompatabilty("Sqlite does not support alter column");
 }
开发者ID:robinvarg,项目名称:fluentmigrator,代码行数:4,代码来源:SqliteGenerator.cs

示例15: CanAlterColumnAndSetAsNullable

        public void CanAlterColumnAndSetAsNullable()
        {
            var expression = new AlterColumnExpression
            {
                Column = new ColumnDefinition { Type = DbType.String, Name = "TestColumn1", IsNullable = true },
                SchemaName = "TestSchema",
                TableName = "TestTable1"
            };

            var result = Generator.Generate(expression);
            result.ShouldBe("ALTER TABLE TestSchema.TestTable1 ALTER COLUMN TestColumn1 SET DATA TYPE DBCLOB(1048576) CCSID 1200");
        }
开发者ID:BhuvanB,项目名称:fluentmigrator,代码行数:12,代码来源:Db2GeneratorTests.cs


注:本文中的FluentMigrator.Expressions.AlterColumnExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。