Medo
Medo

Reputation: 967

Entity framework custom migrations

When adding migration can you make the generator add some code to Up() method?

Like a piece of code that would run itself before every migration.

I know you can write it yourself and everything, but can it be done automatically?

Upvotes: 1

Views: 1543

Answers (1)

Martino Bordin
Martino Bordin

Reputation: 1471

You can use MigrationOperation, that allows to declare a database agnostic action to execute during migrations and implement it for a specific database vendor.

Take a look to this post to see how it works

Upvotes: 3

Related Questions