怎么办DB第一种方法迁移 [英] How to do Migrations in DB first approach

查看:152
本文介绍了怎么办DB第一种方法迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用实体框架数据库第一的方针,并想知道如何管理数据库中的第一种方法的迁移。我们正在做的手动更改数据库架构。有没有什么办法由实体框架可以相应地将更改应用到项目中。

I am using entity framework DB first approach and wants to know how can i manage migrations in DB first approach. We're doing changes in database schema manually. Is there any way by which Entity Framework can apply the changes accordingly to the project.

推荐答案

我想我很困惑的code先用现有的数据库和数据库第一与模型。 我的理解是,寻找在不同的论坛后,迁移只允许在code第一种方法。 code首先假定你将永远不会手动对数据库进行任何更改。所有对数据库的修改将通过code首先迁移。 这适用于code先用现有的数据库中。如果你正在使用code先用现有的数据库,然后它假设连接数据库的首次毕竟对数据库的修改将通过code第一次迁移,而不是手动。 当您使用模式,而不是那么任何手动更改数据库可以通过迁移到模型code第一种方法更新模型,从数据库选项。这可以通过右键单击该模型进行访问。

I guess I got confused between the code first with existing database and database first with model. What I understood is, after searching in different forums, Migrations are allowed only in code first approach. Code first assumes that you will never make any changes manually to the database. All the changes to the database will go through the code first migrations. This is true for code first with an existing database as well. If you are working with code first with existing database then it assumes that after connecting the the database for first time all the changes to the database will go through the code first migration instead of manually. When you are using Model instead of code first approach then any manual changes to the database can be migrated to the model by Update model from DataBase option. Which can be accessed by right clicking on the model.

我希望我的理解是正确的,但任何修改或更正是受欢迎的。

I hope my understanding is correct but any modifications or corrections are welcome.

这篇关于怎么办DB第一种方法迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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