Windows Azure publishes a profile that does not update the database

I am using Windows Azure to host an ASP.NET MVC4 web application. I want to use basic database programming and follow this guide to create a database and data model.

Then I created a website with a linked database in Windows Azure. I downloaded the publication profile and imported it through VS2012 into the project. I noticed that the database connection strings were not included, so I compiled them from a database created in Azure.

In the Publishing Wizard, under the Settings tab, I was able to check the Update Database checkbox, and when I first published the site, everything went fine and the website and database were uploaded.

Then I made some changes to the database, updated the data model as described in the above tutorial, updated my code and built the project. This time, when I went into the Publish wizard and selected the "Settings" tab, I can no longer select the "Update Database" checkbox. Instead, there is a disabled checkbox called "Perform the first code transaction (starts when the application starts)."

Why can I no longer check the "Update database" box? Do I need to manually update the database? I tried to create a datamodel again, but that didn't help.

+4
source share
1 answer

This is perfectly normal behavior. You set this parameter for the first time, and in sequential deployments, the first code migrations are performed first when the application starts. EF (Entity framework) will start Code-First migration then.

Especially when you update your model manually.

You do not need to update your database manually. This will be done when the application starts. When your web application launches, select the migration option.

Read more here:

First EF Deployment for Cloud Deployment <

+3
source

Source: https://habr.com/ru/post/1494858/


All Articles