Entity Framework Code First - Firebird migration: No MigrationSqlGenerator?

自作多情 提交于 2019-12-08 11:42:47

问题


I'm searching for a way to update my firebird-database. I tried using migrations:

    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()" gives me the following Exception:

No MigrationSqlGenerator found for provider 'FirebirdSql.Data.FirebirdClient'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

I have to specify a MigrationSQLGenerator in the Configuration. But I can't find it in the FirebirdClient.dll. The only solution I found was to rewrite it on my own: https://github.com/mrward/entityframework-sharpdevelop/blob/master/src/EntityFramework/Migrations/Sql/SqlCeMigrationSqlGenerator.cs

Is a Firebird specific MigrationSQLGenerator really necessary and not not provided to enable migrations?

My Environment: EntityFramework 5.0.0 .NET 4.5 FirebirdClient 3.0.2.0


回答1:


Migrations are currently not supported. Actually you can use migrations, but you'll have to generate the script and change it to fit Firebird-flavor SQL.



来源:https://stackoverflow.com/questions/17853226/entity-framework-code-first-firebird-migration-no-migrationsqlgenerator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!