简体   繁体   English

实体框架代码第一次迁移保留现有数据

[英]entity framework code first migration keep existing data

I am using EF 6.1 and I use code first approach with an existing database with data in a production environment.我正在使用 EF 6.1,并且在生产环境中使用带有数据的现有数据库的代码优先方法。

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):是的,但是,根据具体情况(更改的复杂性),它可能会很复杂:

Overview: 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/existing-database

Read this: 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/index

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

Update: updated the links based on redirects.更新:更新基于重定向的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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