我正在寻找一种更新我的firebird-database的方法。我尝试使用迁移:
private void btnUpdateDb_Click(object sender, EventArgs e)
{
DbConnection userDBConnection = ClassBasicRepository.GetDBConnection();
var configuration = new Configuration();
configuration.TargetDatabase = new DbConnectionInfo(
userDBConnection.ConnectionString,
"FirebirdSql.Data.FirebirdClient");
DbMigrator migrator = new DbMigrator(configuration);
migrator.Update();
}
DbMigrationsConfiguration:
public sealed class Configuration : DbMigrationsConfiguration<BaseDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
//SetSqlGenerator("FirebirdSql.Data.FirebirdClient", new FirebirdSql.Data.Entity.???);
}
protected override void Seed(BaseDbContext context)
{
MigrationsAssembly = Assembly.GetExecutingAssembly();
MigrationsNamespace = "MyServices.Data.Migrations";
}
}
“migrator.Update()”给出了以下异常:
找不到提供商'FirebirdSql.Data.FirebirdClient'的MigrationSqlGenerator。使用目标迁移配置类中的SetSqlGenerator方法注册其他SQL生成器。
我必须在Configuration中指定MigrationSQLGenerator。但我在FirebirdClient.dll中找不到它。我找到的唯一解决方案是自己重写它: https://github.com/mrward/entityframework-sharpdevelop/blob/master/src/EntityFramework/Migrations/Sql/SqlCeMigrationSqlGenerator.cs
Firebird特定的MigrationSQLGenerator是否真的有必要而且没有提供以启用迁移?
我的环境: EntityFramework 5.0.0 .NET 4.5 FirebirdClient 3.0.2.0
答案 0 :(得分:1)
目前不支持迁移。实际上您可以使用迁移,但是您必须生成脚本并将其更改为适合Firebird风格的SQL。