There is a forum post with the following questions. Does anyone know the answers?
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/cba32c2a-fe84-4d6b-93ff-077dc3046589
· 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.
1. Could the DbMigration.AddOperation be made public (with the caveat that it won't do anything without the supporting MigrationSqlGenerator).
2. 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].
Comments: Hi, Annouce that as we commented [here](http://entityframework.codeplex.com/discussions/429503) I have submitted the [pull request](http://entityframework.codeplex.com/SourceControl/network/forks/iceclow/efmigrationextensions/contribution/4023) that enables this scenario. Any comments are welcome.
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/cba32c2a-fe84-4d6b-93ff-077dc3046589
· 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.
1. Could the DbMigration.AddOperation be made public (with the caveat that it won't do anything without the supporting MigrationSqlGenerator).
2. 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].
Comments: Hi, Annouce that as we commented [here](http://entityframework.codeplex.com/discussions/429503) I have submitted the [pull request](http://entityframework.codeplex.com/SourceControl/network/forks/iceclow/efmigrationextensions/contribution/4023) that enables this scenario. Any comments are welcome.