ASP.NET Web Deployment using Visual Studio - Microsoft Learn
文章推薦指數: 80 %
Deploy the database update · Open the Publish Web wizard by right-clicking the ContosoUniversity project and clicking Publish. · Select the Test ...
Skiptomaincontent
Thisbrowserisnolongersupported.
UpgradetoMicrosoftEdgetotakeadvantageofthelatestfeatures,securityupdates,andtechnicalsupport.
DownloadMicrosoftEdge
MoreinfoaboutInternetExplorerandMicrosoftEdge
Tableofcontents
Exitfocusmode
ReadinEnglish
Save
Tableofcontents
ReadinEnglish
Save
Edit
Print
Twitter
LinkedIn
Facebook
Email
Tableofcontents
ASP.NETWebDeploymentusingVisualStudio:DeployingaDatabaseUpdate
Article
07/21/2022
8minutestoread
8contributors
Inthisarticle
byTomDykstra
DownloadStarterProject
Thistutorialseriesshowsyouhowtodeploy(publish)anASP.NETwebapplicationtoAzureAppServiceWebAppsortoathird-partyhostingprovider,byusingVisualStudio2012orVisualStudio2010.Forinformationabouttheseries,seethefirsttutorialintheseries.
Overview
Inthistutorial,youmakeadatabasechangeandrelatedcodechanges,testthechangesinVisualStudio,thendeploytheupdatetothetest,staging,andproductionenvironments.
ThetutorialfirstshowshowtoupdateadatabasethatismanagedbyCodeFirstMigrations,andthenlateritshowshowtoupdateadatabasebyusingthedbDacFxprovider.
Reminder:Ifyougetanerrormessageorsomethingdoesn'tworkasyougothroughthetutorial,besuretocheckthetroubleshootingpage.
DeployadatabaseupdatebyusingCodeFirstMigrations
Inthissection,youaddabirthdatecolumntothePersonbaseclassfortheStudentandInstructorentities.Thenyouupdatethepagethatdisplaysinstructordatasothatitdisplaysthenewcolumn.Finally,youdeploythechangestotest,staging,andproduction.
Addacolumntoatableintheapplicationdatabase
IntheContosoUniversity.DALproject,openPerson.csandaddthefollowingpropertyattheendofthePersonclass(thereshouldbetwoclosingcurlybracesfollowingit):
[DisplayFormat(DataFormatString="{0:d}",ApplyFormatInEditMode=true)]
[Display(Name="BirthDate")]
publicDateTime?BirthDate{get;set;}
Next,updatetheSeedmethodsothatitprovidesavalueforthenewcolumn.OpenMigrations\Configuration.csandreplacethecodeblockthatbeginsvarinstructors=newListUserInformation
延伸文章資訊
- 1EF Core 工具參考(套件管理員主控台) - Microsoft Learn
Entity Framework Core Visual Studio 套件管理員主控台的參考指南. ... Script-DbContext; Script-Migration; Update...
- 2Update Database From Model Wizard - Overview
This article is relevant to entity models that utilize the deprecated Visual Studio integration o...
- 3update the database from package manager console in code ...
I'm trying to update the database from package Manager console.If my Domain class change, I have ...
- 4Compare And Update SQL Server Database Project With ...
In this article, you will learn how to create a SQL Server Database project using Visual Studio 2...
- 5ASP.NET Web Deployment using Visual Studio - Microsoft Learn
Deploy the database update · Open the Publish Web wizard by right-clicking the ContosoUniversity ...