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


C# MigrationRunner.Up方法代码示例

本文整理汇总了C#中FluentMigrator.Runner.MigrationRunner.Up方法的典型用法代码示例。如果您正苦于以下问题:C# MigrationRunner.Up方法的具体用法?C# MigrationRunner.Up怎么用?C# MigrationRunner.Up使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FluentMigrator.Runner.MigrationRunner的用法示例。


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

示例1: CanUseCustomVersionInfo

        public void CanUseCustomVersionInfo()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), new RunnerContext(new TextWriterAnnouncer(System.Console.Out)) { Namespace = "FluentMigrator.Tests.Integration.Migrations.Interleaved.Pass3" }, processor);

                IVersionTableMetaData tableMetaData = new TestVersionTableMetaData();

                //ensure table doesn't exist
                if (processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName))
                    runner.Down(new VersionMigration(tableMetaData));

                //ensure schema doesn't exist
                if (processor.SchemaExists(tableMetaData.SchemaName))
                    runner.Down(new VersionSchemaMigration(tableMetaData));

                runner.Up(new VersionSchemaMigration(tableMetaData));
                processor.SchemaExists(tableMetaData.SchemaName).ShouldBeTrue();

                runner.Up(new VersionMigration(tableMetaData));
                processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName).ShouldBeTrue();

                runner.Down(new VersionMigration(tableMetaData));
                processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName).ShouldBeFalse();

                runner.Down(new VersionSchemaMigration(tableMetaData));
                processor.SchemaExists(tableMetaData.SchemaName).ShouldBeFalse();
            }, true, typeof(SqliteProcessor));
        }
开发者ID:mallen,项目名称:fluentmigrator,代码行数:29,代码来源:VersionMigrationTests.cs

示例2: CanApplyForeignKeyConventionWithSchema

        public void CanApplyForeignKeyConventionWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestForeignKeyNamingConventionWithSchema());

                    processor.ConstraintExists("TestSchema", "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();
                    runner.Down(new TestForeignKeyNamingConvention());
                }, false, typeof(SqliteProcessor));
        }
开发者ID:chrispfarrell,项目名称:fluentmigrator,代码行数:13,代码来源:MigrationRunnerTests.cs

示例3: CanAlterColumnWithSchema

        public void CanAlterColumnWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();

                    runner.Up(new TestAlterColumnWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();

                    runner.Down(new TestAlterColumnWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SqliteProcessor), typeof(FirebirdProcessor) });
        }
开发者ID:patrickbird,项目名称:fluentmigrator,代码行数:23,代码来源:MigrationRunnerTests.cs

示例4: CanRunMigration

        public void CanRunMigration()
        {
            ExecuteWithSupportedProcessors(processor =>
                {
                    var conventions = new MigrationConventions();

                    var runner = new MigrationRunner(conventions, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.TableExists("TestTable").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.TableExists("TestTable").ShouldBeFalse();
                });
        }
开发者ID:rtw,项目名称:fluentmigrator,代码行数:15,代码来源:MigrationRunnerTests.cs

示例5: CanApplyIndexConvention

        public void CanApplyIndexConvention()
        {
            var connection = new SqlConnection(sqlServerConnectionString);
             connection.Open();
             var processor = new SqlServerProcessor(connection, new SqlServerGenerator());

             var conventions = new MigrationConventions();
             var runner = new MigrationRunner(conventions, processor);

             runner.Up(new TestIndexNamingConvention());
             processor.TableExists("Users").ShouldBeTrue();

             runner.Down(new TestIndexNamingConvention());
             processor.TableExists("Users").ShouldBeFalse();
        }
开发者ID:rtw,项目名称:fluentmigrator,代码行数:15,代码来源:MigrationRunnerTests.cs

示例6: CanRunMigration

        public void CanRunMigration()
        {
            ExecuteWithSupportedProcessors(processor =>
                {
                    var conventions = new MigrationConventions();

                    var runner = new MigrationRunner(conventions, processor, new TextWriterAnnouncer(System.Console.Out), new StopWatch());

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.TableExists("TestTable").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.TableExists("TestTable").ShouldBeFalse();
                });
        }
开发者ID:paulbatum,项目名称:fluentmigrator,代码行数:15,代码来源:MigrationRunnerTests.cs

示例7: CanApplyIndexConvention

        public void CanApplyIndexConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var conventions = new MigrationConventions();
                    var runner = new MigrationRunner(conventions, processor, new TextWriterAnnouncer(System.Console.Out), new StopWatch());

                    runner.Up(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeTrue();

                    runner.Down(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeFalse();
                });
        }
开发者ID:paulbatum,项目名称:fluentmigrator,代码行数:15,代码来源:MigrationRunnerTests.cs

示例8: CanApplyIndexConvention

        public void CanApplyIndexConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var conventions = new MigrationConventions();
                    var runner = new MigrationRunner(conventions, processor);

                    runner.Up(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeTrue();

                    runner.Down(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeFalse();
                });
        }
开发者ID:ngbrown,项目名称:fluentmigrator,代码行数:15,代码来源:MigrationRunnerTests.cs

示例9: CanApplyForeignKeyConvention

        public void CanApplyForeignKeyConvention()
        {
            var connection = new SqlConnection(sqlServerConnectionString);
            connection.Open();
            var processor = new SqlServerProcessor(connection, new SqlServerGenerator());

             var conventions = new MigrationConventions();
             var runner = new MigrationRunner(conventions, processor);

             runner.Up(new TestForeignKeyNamingConvention());
             processor.TableExists("Users").ShouldBeTrue();
             processor.ConstraintExists( "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();

             runner.Down(new TestForeignKeyNamingConvention());
             processor.TableExists("Users").ShouldBeFalse();
        }
开发者ID:rtw,项目名称:fluentmigrator,代码行数:16,代码来源:MigrationRunnerTests.cs

示例10: CanSilentlyFail

        public void CanSilentlyFail()
        {
            var processor = new Mock<IMigrationProcessor>();
            processor.Setup(x => x.Process(It.IsAny<CreateForeignKeyExpression>())).Throws(new Exception("Error"));
            processor.Setup(x => x.Process(It.IsAny<DeleteForeignKeyExpression>())).Throws(new Exception("Error"));

            var conventions = new MigrationConventions();

            var runner = new MigrationRunner(conventions, processor.Object) { SilentlyFail = true };

            runner.Up(new TestForeignKeySilentFailure());
            runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);

            runner.Down(new TestForeignKeySilentFailure());
            runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);
        }
开发者ID:rtw,项目名称:fluentmigrator,代码行数:16,代码来源:MigrationRunnerTests.cs

示例11: CanApplyIndexConvention

        public void CanApplyIndexConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeTrue();

                    runner.Down(new TestIndexNamingConvention());
                    processor.TableExists("Users").ShouldBeFalse();

                    //processor.CommitTransaction();
                });
        }
开发者ID:Ang3lFir3,项目名称:fluentmigrator,代码行数:16,代码来源:MigrationRunnerTests.cs

示例12: CanApplyForeignKeyConvention

        public void CanApplyForeignKeyConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var conventions = new MigrationConventions();
                    var runner = new MigrationRunner(conventions, processor);

                    runner.Up(new TestForeignKeyNamingConvention());
                    processor.TableExists("Users").ShouldBeTrue();
                    processor.ConstraintExists("Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();

                    runner.Down(new TestForeignKeyNamingConvention());
                    processor.TableExists("Users").ShouldBeFalse();
                });
        }
开发者ID:ngbrown,项目名称:fluentmigrator,代码行数:16,代码来源:MigrationRunnerTests.cs

示例13: CanApplyForeignKeyConvention

        public void CanApplyForeignKeyConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestForeignKeyNamingConvention());

                    // This is a hack until MigrationVersionRunner and MigrationRunner are refactored and merged together
                    //processor.CommitTransaction();

                    processor.ConstraintExists( "Users", "FK_Users_GroupId_Groups_GroupId" ).ShouldBeTrue();
                    runner.Down( new TestForeignKeyNamingConvention() );
                });
        }
开发者ID:Ang3lFir3,项目名称:fluentmigrator,代码行数:16,代码来源:MigrationRunnerTests.cs

示例14: CanUseVersionInfo

        public void CanUseVersionInfo()
        {
            ExecuteWithSupportedProcessors(processor =>
                {
                    var runner = new MigrationRunner(new MigrationConventions(), processor);

                    //ensure table doesn't exist
                    if (processor.TableExists(VersionInfo.TABLE_NAME))
                        runner.Down(new VersionMigration());

                    runner.Up(new VersionMigration());
                    processor.TableExists(VersionInfo.TABLE_NAME).ShouldBeTrue();

                    runner.Down(new VersionMigration());
                    processor.TableExists(VersionInfo.TABLE_NAME).ShouldBeFalse();
                });
        }
开发者ID:stevehodgkiss,项目名称:fluentmigrator,代码行数:17,代码来源:VersionMigrationTests.cs

示例15: CanRunMigration

        public void CanRunMigration()
        {
            ExecuteWithSupportedProcessors(processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());

                    processor.TableExists(null, "TestTable").ShouldBeTrue();

                    // This is a hack until MigrationVersionRunner and MigrationRunner are refactored and merged together
                    //processor.CommitTransaction();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.TableExists(null, "TestTable").ShouldBeFalse();
                });
        }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:17,代码来源:MigrationRunnerTests.cs


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