问题
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