There is a forum post with the following questions. Does anyone know the answers?
· There are some extensibility points in EF Code First migrations.
In Migrations.Configuration I can set the SqlGenerator:
SetSqlGenerator(""System.Data.SqlClient"", new CustomizedSqlGenerator());
I can derive from SqlServerMigrationSqlGenerator and override methods.
I can make new operations derived from MigrationOperation - but the DbMigration base class doesn't allow you to add them to it's internal list (AddOperation is internal)
A class derived from SqlServerMigrationSqlGenerator will not recognize additional operations (the Generate(IEnumerable<MigrationOperation>) reflects against it's own Generate methods, not derived ones, apparently). I could create a completely custom MigrationSqlGenerator,
but I still couldn't get the operations from the migration.
I can just write Sql strings in the DbMigration, but it would be nicer to use more structured and potentially database agnostic MigrationOperations.
- Could the DbMigration.AddOperation be made public (with the caveat that it won't do anything without the supporting MigrationSqlGenerator).
- Could the SqlServerMigrationSqlGenerator.Generate(IEnumerable<MigrationOperation>) method be revised to look for any supporting Generate(MigrationOperation) - or some other extensibility point where I can plug in new MigrationOperations?
This item was migrated from the Migrations work item tracking system [ID=47500].