[英]How to update existing entity framework, after adding new table in database by azure management portal
I am using VS2013 and Azure SDK 2.3, I have C# application developed in c# and DB hosted on azure cloud service, as I am new to azure I want to know that If I add any table in existing database hosted on azure through azure management portal then how I can get effect of that changes in my entity framework. 我正在使用VS2013和Azure SDK 2.3,我已经用c#开发了C#应用程序,并且将数据库托管在azure云服务上,因为对于azure来说我是新手,所以我想知道,如果我通过azure管理门户在azure上托管的现有数据库中添加任何表,那么我如何才能在实体框架中获得这种改变的效果。
As this app is not developed fully by me so I don't know much about it's details. 由于此应用程序不是我完全开发的,因此我对其详细信息并不了解。
For Database first approach follow below steps to achieve your task. 对于数据库优先方法,请按照以下步骤完成任务。
When you add/modify some table in the production database, you have to update your application. 在生产数据库中添加/修改某些表时,必须更新应用程序。
First thing to do is edit the web.config/app.config of the application, pointing the connection string to the production database (in your case, database in azure). 首先要做的是编辑应用程序的web.config / app.config,将连接字符串指向生产数据库(在您的情况下为Azure数据库)。
If you are using db-first, update the model from database. 如果您使用db-first,请从数据库更新模型。
If you are using code-first, it is better to make changes in your classes, and then update the database structure via data migrations. 如果您先使用代码,则最好在类中进行更改,然后通过数据迁移来更新数据库结构。 Otherwise, you might have some problems in the future updates, because the current database structure and the migration history will not match.
否则,在将来的更新中可能会遇到一些问题,因为当前的数据库结构和迁移历史记录将不匹配。
Update the application in the azure cloud service. 更新Azure云服务中的应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.