简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM