我正在寻找一种方法来更新我的 firebird 数据库。我尝试使用迁移:
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();
}
DbMigrations 配置:
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 生成器。
我必须在配置中指定一个 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