First knowledge of ASP. NET mvc2.0

Source: Internet
Author: User

This articleArticleIt is to introduce the basic concepts of MVC and provide a knowledge reserve before getting started for beginners.

First, let's talk about the concept of MVC:

ASP. net mvc mode is a manifestation mode. It combines web applicationsProgramIt is divided into three main components: model, view, and controller.

(1) The following describes the positioning of M, V, and C respectively:
M: model is mainly used to store or process data.
In fact, the model implements operations on the corresponding database of the entity class at the business logic layer, such as Aud. It includes data, verification rules, data access, and business logic.

Application information.
V: view is a user interface layer component. It mainly displays the data in the model to the user.
C: control processes user interaction, obtains data from the model, and transmits the data to the specified view.

(2) Responsibilities of the controller and view:

The role of a controller object is to transmit data, obtain the view object (class implementing the iview Interface), and notify the view object to display.
The role of the view object is to display. Although the displayed method renderview () is called by the Controller, the controller is only a "Commander" role,

The specific display logic is still in the view object.

(3) dependency between the three components

Take a look at the figure:

We can understand:

Both view and controller can directly request the model, but the model does not depend on view and controller.
The controller can directly request the view to display the specific page view without relying on the controller. In fact, the view can request the Controller in another way.

(4) History of URL requests

Take a look at the figure below. Note: This is taken from the video of instructor su Peng!

A request is first captured by the view and then transmitted to the routing. The routing parses and calls the specific controller action according to the user's request. Then the Controller returns a viewresult to viewengine and writes it to response.

 

First recognized ASP. NET mvc2.0 first recognized ASP. NET mvc2.0 [continued]

ASP. NET mvc2.0 URL routing entry-instance

ASP. NET mvc2.0 URL routing entry

Introduction to ASP. NET mvc3 (I) Environment preparations

ASP. NET mvc3 introduction to the ASP. NET mvc3 Project (II)

ASP. NET mvc3 simple getting started Season 1 (3) Introduction to filter in Controller

ASP. NET mvc3 simple getting started Season 1 (4) Detailed description of request processing pipeline

Next article: ASP. net mvc recognition [continued]

Related Article

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.