Run Code First Migration Seed Method without a migration

放肆的年华 提交于 2019-12-14 03:39:58

问题


How do you run a code first entity framework migration without changing anything in the datamodel which would cause a migration to be created? I just want to run the seed method again because I added things to it.


回答1:


If you just need to run Seed() again, and nothing has changed that would cause a new migration to be added, just call Update-Database again with no flags and it will say 'No pending migrations', and run Seed() again for you. Seed() is called every time the DB is updated, regardless if there are new migrations or not.



来源:https://stackoverflow.com/questions/28745676/run-code-first-migration-seed-method-without-a-migration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!