本文整理汇总了C#中FluentMigrator.Runner.Processors.SqlServer.SqlServerProcessor类的典型用法代码示例。如果您正苦于以下问题:C# SqlServerProcessor类的具体用法?C# SqlServerProcessor怎么用?C# SqlServerProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlServerProcessor类属于FluentMigrator.Runner.Processors.SqlServer命名空间,在下文中一共展示了SqlServerProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
Connection = new SqlConnection(IntegrationTestOptions.SqlServer2012.ConnectionString);
Processor = new SqlServerProcessor(Connection, new SqlServer2012Generator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new SqlServerDbFactory());
Connection.Open();
Processor.BeginTransaction();
}
示例2: SqlServerProcessorTests
public SqlServerProcessorTests()
{
Connection = new SqlConnection(@"server=(local)\sqlexpress;uid=;pwd=;Trusted_Connection=yes;database=FluentMigrator");
Connection.Open();
Processor = new SqlServerProcessor(Connection, new SqlServer2000Generator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
}
示例3: ExecuteWithSqlServer
public void ExecuteWithSqlServer(Action<IMigrationProcessor> test)
{
var connection = new SqlConnection(sqlServerConnectionString);
connection.Open();
var processor = new SqlServerProcessor(connection, new SqlServerGenerator());
test(processor);
}
示例4: Run
public static void Run(string connectionString)
{
var firstMigration = typeof(Lucid.Database.Migrations.Y2016.M01.V01);
var assembly = new SingleAssembly(firstMigration.Assembly);
var migrationGenerator = new SqlServer2008Generator();
var announcer = new NullAnnouncer();
var options = new ProcessorOptions();
var dbFactory = new SqlServerDbFactory();
var runnerContext = new RunnerContext(announcer)
{
Database = "SqlServer2008",
Connection = connectionString,
Targets = new string[] { firstMigration.Assembly.FullName },
NestedNamespaces = true,
Namespace = "Lucid.Database.Migrations",
};
using (var connection = new SqlConnection(connectionString))
using (var processor = new SqlServerProcessor(connection, migrationGenerator, announcer, options, dbFactory))
{
var runner = new MigrationRunner(assembly, runnerContext, processor);
runner.MigrateUp();
}
}
示例5: SqlServerProcessorTests
public SqlServerProcessorTests()
{
Connection = new SqlConnection(@"server=(local)\sqlexpress;uid=;pwd=;Trusted_Connection=yes;database=FluentMigrator");
Connection.Open();
Processor = new SqlServerProcessor(Connection, new SqlServerGenerator());
}
示例6: Setup
public void Setup()
{
Connection = new SqlConnection(IntegrationTestOptions.SqlServer2008.ConnectionString);
Processor = new SqlServerProcessor(Connection, new SqlServer2008Generator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new SqlServerDbFactory());
SchemaDumper = new SqlServerSchemaDumper(Processor, new TextWriterAnnouncer(System.Console.Out));
Connection.Open();
}
示例7: SqlServerTestTable
public SqlServerTestTable(SqlServerProcessor processor, params string[] columnDefinitions)
{
Connection = processor.Connection;
Transaction = processor.Transaction;
Name = "Table" + Guid.NewGuid().ToString("N");
Create(columnDefinitions);
}
示例8: SqlServerTestSequence
public SqlServerTestSequence(SqlServerProcessor processor, string schemaName, string sequenceName)
{
_schemaName = schemaName;
Name = sequenceName;
Connection = (SqlConnection)processor.Connection;
Transaction = (SqlTransaction)processor.Transaction;
Create();
}
示例9: SqlServerTestTable
public SqlServerTestTable(string table, SqlServerProcessor processor, string schemaName, params string[] columnDefinitions)
{
this.schemaName = schemaName;
Connection = (SqlConnection)processor.Connection;
Transaction = (SqlTransaction)processor.Transaction;
Name = table;
Create(columnDefinitions);
}
示例10: ExecuteWithSqlServer
private static void ExecuteWithSqlServer(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions)
{
if (!serverOptions.IsEnabled)
return;
var connection = new SqlConnection(serverOptions.ConnectionString);
connection.Open();
var processor = new SqlServerProcessor(connection, new SqlServer2000Generator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
test(processor);
}
示例11: getRunner
MigrationRunner getRunner()
{
var connectionString = ConfigurationManager.ConnectionStrings["dahliaSQL"].ConnectionString;
var connection = new SqlConnection(connectionString);
var assembly = typeof(SqlMigrationService).Assembly;
var ns = typeof(SqlMigrationService).Namespace;
var generator = new SqlServer2005Generator();
var processor = new SqlServerProcessor(connection, generator, new NullAnnouncer(), new ProcessorOptions());
return new MigrationRunner(assembly, new RunnerContext(new NullAnnouncer()) { Namespace = ns },
processor);
}
示例12: ExecuteWithSqlServer
protected static void ExecuteWithSqlServer(Action<IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions, Boolean tryRollback)
{
if (!serverOptions.IsEnabled)
return;
var connection = new SqlConnection(serverOptions.ConnectionString);
var processor = new SqlServerProcessor(connection, new SqlServer2000Generator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
test(processor);
if (tryRollback && !processor.WasCommitted)
{
processor.RollbackTransaction();
}
}
示例13: 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();
}
示例14: EnsureMigration
private void EnsureMigration()
{
var connection = new System.Data.SqlClient.SqlConnection(connectionString);
connection.Open();
var processor = new SqlServerProcessor(connection, new SqlServer2000Generator(),
new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
var conventions = new MigrationConventions();
var versionRunner = new FluentMigrator.Runner.MigrationVersionRunner(conventions, processor,
new MigrationLoader(conventions), new NullAnnouncer());
//var runner = new MigrationRunner(conventions, processor, new TextWriterAnnouncer(System.Console.Out), new StopWatch());
//runner.Up(new TestCreateAndDropTableMigration());
versionRunner.MigrateUp();
versionRunner = null;
connection = null;
}
示例15: 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();
}