本文整理汇总了C#中FluentMigrator.Runner.Announcers.TextWriterAnnouncer.Heading方法的典型用法代码示例。如果您正苦于以下问题:C# TextWriterAnnouncer.Heading方法的具体用法?C# TextWriterAnnouncer.Heading怎么用?C# TextWriterAnnouncer.Heading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluentMigrator.Runner.Announcers.TextWriterAnnouncer
的用法示例。
在下文中一共展示了TextWriterAnnouncer.Heading方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteWithSqlite
protected static void ExecuteWithSqlite(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions)
{
if (!serverOptions.IsEnabled)
return;
var announcer = new TextWriterAnnouncer(System.Console.Out);
announcer.Heading("Testing Migration against SQLite");
var factory = new SqliteDbFactory();
using (var connection = factory.CreateConnection(serverOptions.ConnectionString))
{
var processor = new SqliteProcessor(connection, new SqliteGenerator(), announcer, new ProcessorOptions(), factory);
test(processor);
}
}
示例2: 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);
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: ExecuteWithFirebird
protected static void ExecuteWithFirebird(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions)
{
if (!serverOptions.IsEnabled)
return;
var announcer = new TextWriterAnnouncer(System.Console.Out);
announcer.ShowSql = true;
announcer.Heading("Testing Migration against Firebird Server");
if (!System.IO.File.Exists("fbtest.fdb"))
{
FbConnection.CreateDatabase(serverOptions.ConnectionString);
}
using (var connection = new FbConnection(serverOptions.ConnectionString))
{
var options = FirebirdOptions.AutoCommitBehaviour();
var processor = new FirebirdProcessor(connection, new FirebirdGenerator(options), announcer, new ProcessorOptions(), new FirebirdDbFactory(), options);
try
{
test(processor);
}
catch (Exception)
{
if (!processor.WasCommitted)
processor.RollbackTransaction();
throw;
}
connection.Close();
}
}
示例6: ExecuteWithPostgres
protected static void ExecuteWithPostgres(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions, Boolean tryRollback)
{
if (!serverOptions.IsEnabled)
return;
var announcer = new TextWriterAnnouncer(System.Console.Out);
announcer.Heading("Testing Migration against Postgres");
using (var connection = new NpgsqlConnection(serverOptions.ConnectionString))
{
var processor = new PostgresProcessor(connection, new PostgresGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new PostgresDbFactory());
test(processor);
if (!processor.WasCommitted)
{
processor.RollbackTransaction();
}
}
}