【问题标题】:entity framework code first migration keep existing data实体框架代码先迁移保留现有数据
【发布时间】:2014-05-01 20:21:42
【问题描述】:

我使用的是 EF 6.1,并且我在现有数据库中使用代码优先方法以及生产环境中的数据。

是否可以迁移模型更改并保留现有客户的数据?

【问题讨论】:

  • 迁移不就是为了这个吗?
  • 什么样的模型变化?能给我举个例子吗?代码优先不需要您在每次迁移时删除并重新创建数据库

标签: entity-framework entity-framework-6.1


【解决方案1】:

是的,但是,根据具体情况(根据更改的复杂性),它可能会很复杂:

概览: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

更新:根据重定向更新链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多