Lieke
Lieke

Reputation: 311

Entity framework custom SqlServerMigrationSqlGenerator , generate not being called

I made a custom SqlServerMigrationSqlGenerator to remove calculated fields from the migrations by their annotation and used SetSqlGenerator("System.Data.SqlClient", new TestSqlServerMigrationSqlGenerator()); in the DbMigrationsConfiguration to set it to be used. But it doesn't seems to be being called.

Are there any other requirements to override the sqlgenerater. I'm already overriding all generate methods in the SqlServerMigrationSqlGenerator and calling System.Diagnostics.Debugger.Launch(); to see if it's being called. I also tried to remove everything in the methods but this also has no effect.

Upvotes: 1

Views: 520

Answers (1)

Lieke
Lieke

Reputation: 311

Apparently the SqlServerMigrationSqlGenerator only gets called when a update-database is done. While i thought it would be used when calling de add-migration.

Upvotes: 7

Related Questions