• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Announcers.TextWriterAnnouncer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: UpgradeDatabase

        public void UpgradeDatabase()
        {
            var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            var announcer = new TextWriterAnnouncer(s => Log.Debug(s));
            var context = new RunnerContext(announcer)
            {
                Namespace = "Causal.Server.Migrations"
            };

            var providerName = ConfigurationManager.ConnectionStrings["CausalContext"].ProviderName;
            MigrationProcessorFactory factory;
            if (providerName.Equals("Npgsql", StringComparison.InvariantCultureIgnoreCase))
            {
                factory = new FluentMigrator.Runner.Processors.Postgres.PostgresProcessorFactory();
            }
            else if (providerName.Equals("System.Data.SqlClient", StringComparison.InvariantCultureIgnoreCase))
            {
                factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2008ProcessorFactory();
            }
            else
            {
                throw new Exception("Unknown provider for connection string CausalContext");
            }

            var options = new ProcessorOptions { PreviewOnly = false };
            var processor = factory.Create(ConfigurationManager.ConnectionStrings["CausalContext"].ConnectionString, announcer, options);
            var migrator = new MigrationRunner(assembly, context, processor);

            migrator.MigrateUp(true);
        }
开发者ID:jennings,项目名称:Causal,代码行数:30,代码来源:Startup.cs


示例2: RunMigrations

        public static void RunMigrations(string connectionString, string migration)
        {
            // var announcer = new NullAnnouncer();
            var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
            var assembly = Assembly.GetExecutingAssembly();

            var migrationContext = new RunnerContext(announcer)
            {
                Namespace = "Azimuth.Migrations",
                WorkingDirectory = "Migrations"
            };

            var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
            var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2012ProcessorFactory();
            var processor = factory.Create(connectionString, announcer, options);
            var runner = new MigrationRunner(assembly, migrationContext, processor);

            switch (migration)
            {
                case "Run migrations":
                    runner.MigrateUp(true);
                    break;
                case "Drop all tables":
                    runner.RollbackToVersion(201408091845);
                    runner.Rollback(1);
                    break;
            }
        }
开发者ID:IhorSyerkov,项目名称:Azimuth,代码行数:28,代码来源:Runner.cs


示例3: Run

        public static void Run(IContainer settingsContainer)
        {
            var connectionString = settingsContainer.GetInstance<string>("DefaultConnection");

            Announcer announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
            announcer.ShowSql = true;

            Assembly assembly = typeof(CreateTableEstacionamento).Assembly;

            IRunnerContext migrationContext = new RunnerContext(announcer);

            var options = new ProcessorOptions
            {
                PreviewOnly = false,  // set to true to see the SQL
                Timeout = 60
            };

            try
            {
                var factory = settingsContainer.GetInstance<MigrationProcessorFactory>(); //new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();
                var processor = factory.Create(connectionString, announcer, options);

                var runner = new MigrationRunner(assembly, migrationContext, processor);
                runner.MigrateUp(true);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("connectionString: " + connectionString, ex);
            }
        }
开发者ID:marcosli,项目名称:multi-vagas,代码行数:30,代码来源:MigrationsRunner.cs


示例4: StartMigration

        public void StartMigration()
        {
            var consoleAnnouncer = new TextWriterAnnouncer(System.Console.Out)
                                        {
                                            ShowElapsedTime = true,
                                            ShowSql = true
                                        };
             var runnerContext = new RunnerContext(consoleAnnouncer)
             {

                 Database= DataBaseType,
                 Connection=connStr,
                 Target=assemblyPath,
                 PreviewOnly= false,
                 Namespace=string.Empty,
                 Task=string.Empty,
                 Version=0,
                 Steps=1,
                 WorkingDirectory = currentPath,
                 Profile=string.Empty,
                 Timeout=0,
                 ConnectionStringConfigPath=string.Empty
             };
             TaskExecutor tskMigration = new TaskExecutor(runnerContext);
             tskMigration.Execute();
        }
开发者ID:majimenezp,项目名称:AppGen,代码行数:26,代码来源:MigratorExecuter.cs


示例5: Rollback

 public void Rollback(bool showSql = false)
 {
     using (var announcer = new TextWriterAnnouncer(Console.Out) { ShowSql = showSql })
     {
         var runner = CreateRunner(announcer);
         runner.RollbackToVersion(0);
     }
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:8,代码来源:Migrator.cs


示例6: MigrateToLatest

 public void MigrateToLatest(bool showSql = false)
 {
     using (var announcer = new TextWriterAnnouncer(Console.Out) { ShowSql = showSql })
     {
         var runner = CreateRunner(announcer);
         runner.MigrateUp();
     }
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:8,代码来源:Migrator.cs


示例7: Migrator

 public Migrator(DatabaseConfig databaseConfig)
 {
     _databaseConfig = databaseConfig;
     NamespaceContainingMigrations = "Habanero.Test.Migrations";
     AssemblyContainingMigrations = Assembly.GetExecutingAssembly();
     MigrationProcessorFactory = GetMigrationProcessorFactory(databaseConfig);
     Announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
     _databaseInitialiser = new DatabaseInitialiser(databaseConfig);
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:9,代码来源:Migrator.cs


示例8: SetUp

 public void SetUp()
 {
     _stringWriter = new StringWriter();
     _announcer = new TextWriterAnnouncer(_stringWriter)
                      {
                          ShowElapsedTime = true,
                          ShowSql = true
                      };
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:9,代码来源:TextWriterAnnouncerTests.cs


示例9: Migrate

 public void Migrate(Action<IMigrationRunner> runnerAction)
 {
     var options = new MigrationOptions { PreviewOnly = false, Timeout = 0 };
     var factory = new FluentMigrator.Runner.Processors.MigrationProcessorFactoryProvider().GetFactory(_dbType);
     var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
     var migrationContext = new RunnerContext(announcer);
     var processor = factory.Create(_connectionString, announcer, options);
     var runner = new MigrationRunner(_migrationAssembly, migrationContext, processor);
     runnerAction(runner);
 }
开发者ID:lfreneda,项目名称:EasyLocalDb,代码行数:10,代码来源:Migrator.cs


示例10: Migrate

 public void Migrate(Action<IMigrationRunner> runnerAction)
 {
     var options = new MigrationOptions { PreviewOnly = false, Timeout = 0 };
     var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2008ProcessorFactory();
     var assembly = Assembly.GetExecutingAssembly();
     var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
     var migrationContext = new RunnerContext(announcer);
     var processor = factory.Create(this._connectionString, announcer, options);
     var runner = new MigrationRunner(assembly, migrationContext, processor);
     runnerAction(runner);
 }
开发者ID:andreialex007,项目名称:EStore,代码行数:11,代码来源:Migrator.cs


示例11: MakeTask

 private static TaskExecutor MakeTask(string task)
 {
     var announcer = new TextWriterAnnouncer(System.Console.Out);
     var runnerContext = new RunnerContext(announcer)
     {
         Database = "Firebird",
         Connection = IntegrationTestOptions.Firebird.ConnectionString,
         Targets = new[] { Assembly.GetExecutingAssembly().Location },
         Namespace = "FluentMigrator.Tests.Integration.Migrations.Firebird.FirstVersion",
         Task = task,
     };
     return new TaskExecutor(runnerContext);
 }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:13,代码来源:TestInitialMigration.cs


示例12: MakeTask

 protected TaskExecutor MakeTask(string task, string migrationsNamespace)
 {
     var announcer = new TextWriterAnnouncer(System.Console.Out);
     var runnerContext = new RunnerContext(announcer)
     {
         Database = "Firebird",
         Connection = IntegrationTestOptions.Firebird.ConnectionString,
         Targets = new[] { Assembly.GetExecutingAssembly().Location },
         Namespace = migrationsNamespace,
         Task = task
     };
     return new TaskExecutor(runnerContext);
 }
开发者ID:eloekset,项目名称:fluentmigrator,代码行数:13,代码来源:FbEndToEndFixture.cs


示例13: InitializeProcessor

 IMigrationProcessor InitializeProcessor()
 {
     dynamic options = _configuration.MigrationEngineOptions;
     writer = new StringWriter();
     var announcer = new TextWriterAnnouncer(writer);
     var processorFactory = ProcessorFactory.GetFactory(options.DatabaseType);
     var processor = processorFactory.Create(_configuration.ConnectionString,announcer, new ProcessorOptions
     {
         PreviewOnly = false,
         Timeout = options.Timeout
     });
     return processor;
 }
开发者ID:jcteague,项目名称:SchemaMigrator,代码行数:13,代码来源:FluentMigratorRunner.cs


示例14: MigrateToLatest

        public static void MigrateToLatest()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            var migrationAssembly=  Assembly.GetExecutingAssembly();
            var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
            var migrationContext = new RunnerContext(announcer);
            var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2008ProcessorFactory();
            var options = new MigrationOptions { PreviewOnly = false, Timeout = 0 };
            var processor = factory.Create(connectionString, announcer, options);

            var runner = new MigrationRunner(migrationAssembly, migrationContext, processor);
            runner.MigrateUp();
        }
开发者ID:ashes999,项目名称:proton-analytics-v2,代码行数:13,代码来源:MigrationsRunner.cs


示例15: MigrateToLatest

        public void MigrateToLatest()
        {
            var announcer = new TextWriterAnnouncer(s => Debug.WriteLine(s));
            var assembly = Assembly.GetExecutingAssembly();

            var migrationContext = new RunnerContext(announcer);
            var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
            var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2012ProcessorFactory();
            using (var processor = factory.Create(connectionString, announcer, options))
            {
                var runner = new MigrationRunner(assembly, migrationContext, processor);
                runner.MigrateUp(true);
            }
        }
开发者ID:Test-Factory,项目名称:TestFactory,代码行数:14,代码来源:Migrator.cs


示例16: ExecuteWithSqlServer2014

        protected static void ExecuteWithSqlServer2014(Action<IMigrationProcessor> test, bool tryRollback)
        {

            var serverOptions = IntegrationTestOptions.SqlServer2014;

            if (!serverOptions.IsEnabled)
                return;

            var announcer = new TextWriterAnnouncer(System.Console.Out);
            announcer.Heading("Testing Migration against MS SQL Server 2014");
            var generator = new SqlServer2014Generator();

            ExecuteWithSqlServer(serverOptions, announcer, generator, test, tryRollback);
        }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:14,代码来源:IntegrationTestBase.cs


示例17: ExecuteWithMySql

        protected static void ExecuteWithMySql(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions)
        {
            if (!serverOptions.IsEnabled)
                return;

            var announcer = new TextWriterAnnouncer(System.Console.Out);
            announcer.Heading("Testing Migration against MySQL Server");

            using (var connection = new MySqlConnection(serverOptions.ConnectionString))
            {
                var processor = new MySqlProcessor(connection, new MySqlGenerator(), announcer, new ProcessorOptions(), new MySqlDbFactory());
                test(processor);
            }
        }
开发者ID:rebootd,项目名称:fluentmigrator,代码行数:14,代码来源:IntegrationTestBase.cs


示例18: Migrator

        public Migrator(string connectionString, params Assembly[] assemblies)
        {
            var announcer = new TextWriterAnnouncer(Console.Write);

            IAssemblyCollection assemblyCollection = new AssemblyCollection(assemblies);

            var migrationContext = new RunnerContext(announcer);

            var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
            PostgresProcessorFactory factory = new PostgresProcessorFactory();

            IMigrationProcessor processor = factory.Create(connectionString, announcer, options);
            runner = new MigrationRunner(assemblyCollection, migrationContext, processor);
        }
开发者ID:joshilewis,项目名称:lending,代码行数:14,代码来源:Migrator.cs


示例19: MigrateToLatest

        public void MigrateToLatest()
        {
            var asm = Assembly.GetExecutingAssembly();
            var announcer = new TextWriterAnnouncer((str) =>
            {
                Debug.WriteLine(str);
            });
            var context = new RunnerContext(announcer);
            var options = new MigrationOptions();
            var factory = new SqlServer2012ProcessorFactory();
            var processor = factory.Create(this._connectionString, announcer, options);
            var runner = new MigrationRunner(asm, context, processor);

            runner.MigrateUp(true);
        }
开发者ID:musa-zulu,项目名称:LendingLibrary,代码行数:15,代码来源:DBMigrationsRunner.cs


示例20: Execute

        private void Execute(string task)
        {
            tbAnnouncer.Clear();

            var version = (int)numVersion.Value;
            var steps = (int)numSteps.Value;
            var tags = new List<string>();
            var profile = tbProfile.Text;
            foreach (var item in lbTags.SelectedItems)
            {
                tags.Add(item.ToString());
            }

            var announcer = new TextWriterAnnouncer(new TextBoxStreamWriter(tbAnnouncer));
            announcer.Heading("Migrate database");

            var runnerContext = new RunnerContext(announcer)
            {
                Database = "SqlServer2008",
                Connection = ConfigurationManager.ConnectionStrings["FluentMigrator"].ConnectionString,

                Target = "DatabaseProject.dll",
                PreviewOnly = false,
                Namespace = "DatabaseProject",
                NestedNamespaces = true,
                Task = task,
                Version = version,
                Steps = steps,
                Tags = tags,
                //WorkingDirectory = "C:\\temp",
                Profile = profile,
                Timeout = 30,
                TransactionPerSession = true
            };

            var executor = new TaskExecutor(runnerContext);


            try
            {
                executor.Execute();
            }
            catch (Exception ex)
            {
                tbAnnouncer.AppendText("Exception: " + ex.Message);
            }

        }
开发者ID:oyvindfanebust,项目名称:FluentMigratorDemo,代码行数:48,代码来源:frmMain.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Initialization.RunnerContext类代码示例发布时间:2022-05-26
下一篇:
C# Runner.MigrationRunner类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap