实体框架代码先迁移保留现有数据 [英] entity framework code first migration keep existing data
问题描述
我正在使用 EF 6.1,并且我在现有数据库中使用代码优先方法,并在生产环境中使用数据.
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?
推荐答案
是的,但是,根据具体情况(根据更改的复杂性),它可能会很复杂:
Yes, however, it can be complicated depending on specific case (on complexity of changes):
概述:https:///docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/existing-database
阅读:https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/index
然后这个:https:///docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/teams
更新:根据重定向更新链接.
Update: updated the links based on redirects.
这篇关于实体框架代码先迁移保留现有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!