ASP. NET mvc3 Quick Start-Section 1 Overview
1.1 Course of this tutorialXIContent
In this tutorial, you will learn the following:
· How to create an ASP. net mvc project.
· How to create the controller and view of ASP. net mvc ).
· How to Use the Entity Framework Code-first example to create a new database.
· How to obtain and display data.
· How to edit the data and verify the data validity.
1.2 CreateConstruction
If you want to create an ASP. net mvc3 project, first run Visual Web Developer 2010 Express ("Visual Web Developer" in this tutorial), and select "new project" on the start page ".
Visual Web Developer is an integrated development environment that you can use for various applications.ProgramDevelopment. There is a toolbar under the menu of Visual Web Developer. You can directly click each tool button in the toolbar to perform various operations, or you can directly click each menu item in the menu to perform various operations, click the "new project" menu item in the "file" menu.
Figure 1-1 start page of Visual Web Developer 2010 Express
1.3 CreateCreate your firstYingApplication
You can use Visual Basic or Visual C # As the development language to create an application. In this tutorial, select C # As the development language. Click the "new project" menu item. In the "new project" dialog box that opens, double-click "Visual C #" on the left to make it expand. Then, click "Web ", click "ASP. net MVC 3 web application, enter the name of the application in the name text box below, name it "mvcmovie" in this tutorial, and then click OK.
Figure 1-2 select the ASP. Net mvc3 application in the Create Project dialog box and name the application
In the "new ASP. in the "net MVC 3 Project" dialog box, click "Internet application" and in the "view engine" drop-down box, keep the default "Razor" option unchanged (the razor view is ASP. net mvc3 is a very important new view type. Using it can make web application development more convenient and convenient, which will be described in detail later ).
Figure 1-3 select a project template and view Engine
Click OK. Visual Web Developer provides a default template for the ASP. NET MVC project you created, so that you have an application that can be run immediately. The default template provides a simple display "Welcome to ASP. net mvc !" Text application, you can use this as your development start point.
Figure 1-4 Visual Web Developer provides a default Application Template
Click the "start debugging" menu item in the "debug" menu (the shortcut key for this menu item is F5). Visual Web Developer starts a built-in server, open the home page of the current web application on the server, as shown in figure 1-5.
Figure 1-5 debug screen of the default application template of ASP. NET mvc3
Note that the address of the page in the browser is "http: // localhost: 4423 /". "Localhost" indicates the temporary website address of the web application you just created on the local machine, and "4423" indicates a random port used by visual web developer, visual Web developer uses this port as the port number of the built-in server. On each computer, the port number is different because it is randomly selected by visual web developer.
In the upper-right corner of the template application page, two buttons are provided with a "login" link, click the "login" link, the page jumps to the login page, click the "home" button, return to the home page and click "about" to go to the "about" page.
Next, let's begin to gradually change this default application to the application we want, and gradually learn about ASP. net mvc 3 in this process. First, let's close the browser and startCode.