MVC4 instances of VS2012

Source: Internet
Author: User

Original link: http://wenku.baidu.com/link?url=nkq-UZd-Ui83Nuoh66n4KqdwK4V_zzKqakmmG6VBgq2BfWlMiPhz1JXN9R3CWxNsSL49o_q_ Fs9kode-sc5inyvytqg3tyloxryreunjv-w

The content and the original text, just omitted the programmer all know the nonsense, added some diagrams, the ultimate goal is to use the VS2012 template to create additions and deletions to check the demo.

In the New Project dialog box:

    • Open Visual C # templates
    • Choose Template ASP. NET MVC 3 Web Application
    • Set the project name to Mvcdemo
    • Set the disk location, such as C:\w3school_demo
    • Click OK
    • When the New Project dialog box opens:

Select Internet Application Template

    • Select the Razor engine
    • Select the HTML5 tag
    • Click OK

Find out the contents of the files and folders first.

Application Folder

    • App_Data folder
    • Content folder
    • Controllers folder
    • Models folder
    • Scripts folder
    • Views folder


Configuration file

    • Global.asax
    • Packages.config
    • Web. config

The folder names in all MVC applications are equal. The MVC framework is based on the default naming. The controller is located in the Controllers folder, the view is located in the Views folder and the model is in the Models folder. You do not have to use the folder name in your application code.
Standardized naming reduces the amount of code and facilitates the developer's understanding of the MVC project.

Here is a brief description of the contents of each folder:
App_Data folder
The App_Data folder is used to store application data.
We will add the SQL database to the App_Data folder later in this tutorial.
Content Folder
The Content folder is used for static files, such as style sheets (CSS files), charts, and images.

Visual Web Developer automatically adds a themes folder to the Content folder. This themes folder holds jQuery styles and pictures. In this project, you can delete the theme folder.
Visual Web Developer also adds a standard style sheet file to the project: the file Site.css in the Content folder. This style sheet file is the one you want to edit when you change the style of your application.
We will edit this stylesheet file (SITE.CSS) in the next chapter of this tutorial.

Controllers Folder
The Controllers folder contains the controller classes responsible for handling user input and response. MVC requires that the names of all controller files end with "controller".
Visual Web Developer has created good one home controller (for home page and about pages) and an account controller (for login pages):

Models folder

The folder contains classes that represent the application model. The model holds and operates data for the application.

Views folder

The folder has an HTML file (user interface) associated with the display of the application. The Views folder contains a folder for each controller.

Visual Web Developer has created an account folder, a home folder, and a shared folder (within the Views folder).

The account folder contains pages for registering and signing in to user accounts.

The home folder is used to store application pages such as the home page and about pages.

Shared folders are used to store views shared between controllers (template pages and layout pages).

Scripts folder

The Scripts folder stores the application's JavaScript files. By default, Visual Web Developer places standard MVC, Ajax, and jquery files in this folder: Note: The file "Modernizr" is a JavaScript file that supports HTML5 and CSS3 in your application.

At this point, the front is VS2012 himself for us to create a template, I think it is really convenient. Summarize what you need to know later.

Okay, I'll order F5 now.

I configure the data source before the point F5 is error, because Bo master next project to use Access, landlord put an empty access file to App_Data can run.

MVC4 instances of VS2012

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.