保持数据库内容在模式变迁 [英] Keep Database Content On Model Change

查看:138
本文介绍了保持数据库内容在模式变迁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用新4.1 RC提供了code-第一的方针。

Using the code-first approach available in the new 4.1 RC.

有没有办法坚持存储在数据库中,当模式改变当前的数据?该数据库是由实体框架,模式的转变创造,和通常的数据库被删除并重新创建。

Is there any way to persist the current data stored in a database when the mode changes? The database is created by the entity framework, and usually the database is dropped and recreated on model changes.

显然,一旦模型发生改变,将无法使用上下文对象连接到数据库检索数据,所以什么样的选择呢?

Obviously as soon as the model is changed it will not be possible to use the context object to connect to the database to retrieve the data, so what are the options?

推荐答案

code首先不支持数据库迁移/演变呢。如果你想要做增量数据库的开发利用模式第(EDMX)用的DbContext生成T4模板的实体设计数据库生成包,它能够创造差异。从模型脚本。

Code first doesn't support database migration / evolution yet. If you want to do incremental DB development use model first (EDMX) with DbContext Generator T4 template and Entity designer database generation pack which is able to create diff. scripts from the model.

这篇关于保持数据库内容在模式变迁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆