Entity Framework 4.3 Migrations move existing data

◇◆丶佛笑我妖孽 提交于 2020-01-03 10:40:51

问题


I'm using EF Code First 4.3 Migrations to update my database scheme. Now I have the following situation: table A needs to be removed, table B must be created and the data of table A must be copied (along with some other data) to table B. I do not have access to the DbContext in the DbMigration class, my question is how to implement this?


回答1:


In migration Up method of your migration you can use Sql method to define any SQL you need so if you use explicit migration you can put data migration code between creating Table B and removing Table A.



来源:https://stackoverflow.com/questions/11011695/entity-framework-4-3-migrations-move-existing-data

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