entity-framework - Entity Framework 代码中的增量数据库开发

标签 entity-framework entity-framework-4.1 ef-code-first

如何使用 Entity Framework 代码优先数据库进行增量开发。因为如果我更改模型类的某些内容,它将重新生成数据库,这会丢失数据库中已有的数据。我正在使用 DropCreateDatabaseIfModelChanges .除了执行alter quires而不是重新创建之外,还有什么别的方法吗?

最佳答案

EF Code First Migrations 会在这里帮助你,它目前是 alpha/CTP:Entity Framework Code First Migrations: Alpha ,还可以查看 ADO.NET team blog :

The most consistent request we have heard from you since releasing EF 4.1 has been for a migrations solution for Code First that will incrementally evolve the database schema as you model changes over time. Today we are announcing the release of our first Community Technical Preview (CTP) of our Code First Migrations work.

关于entity-framework - Entity Framework 代码中的增量数据库开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7132907/

相关文章:

entity-framework - Linq To Entities - Any VS First VS Exists

c# - 在 Entity FrameWork 中获取新生成的 ID(即 scopeIdentity)

c# - Entity Framework 通用

entity-framework - 通过 EF 插入后获取自动身份 key

asp.net-mvc - WebActivator 有什么作用?

entity-framework - 使用 Repository/UoW/DI 抽象 EntityFramework.dll 引用

c# - Entity Framework 正在替换我的对象的 ID

asp.net-mvc - Entity Framework 代码优先多对多 NullReference

.net - EF 4.1 Code First - 使用 [Required] 属性更新的模型

visual-studio-2010 - 为什么当我想使用 EF Power 工具查看我的模型时出现错误?