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]