entity framework code first migration keep existing data

南笙酒味 提交于 2019-12-03 12:03:10

问题


I am using EF 6.1 and I use code first approach with an existing database with data in a production environment.

Is it possible at all to migrate model changes and keep the existing customer`s data?


回答1:


Yes, however, it can be complicated depending on specific case (on complexity of changes):

Overview: https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/existing-database

Read this: https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/index

And then this: https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/teams

Update: updated the links based on redirects.



来源:https://stackoverflow.com/questions/23415921/entity-framework-code-first-migration-keep-existing-data

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