MVC series Learning (16)-area learning, mvc series learning area

Source: Internet
Author: User

MVC series Learning (16)-area learning, mvc series learning area

1. query the Controller Process

1.1 call controllers in other projects.

A. first go to the bin folder under the root directory of the website to traverse all the Assembly

B. Find the class ending with Controller

C. Find out the class that inherits the Controller

D. Create an object with the same name and call the Action method.

A. in route configuration information, when traversing the controller, you can only search for it in the specified namespace.
B. We can see that namespaces is an array, that is, multiple namespaces can be specified to increase the traversal speed.

A. First, find the View with the same name as the controller in the View folder under the root directory of the Request website.
B. Go to the View folder under the root directory of the requested website to find the View in the shared folder.

1. When the website is started, Application_Start () will be called first. Then, the region route will be registered when the website is started.
When the website starts, first go to the bin folder under the root directory of the website and find the region registration class that inherits the AreaRegistration class,
Create the objects of these classes and call its RegisterArea () method to complete region route registration.
2. Then, in the event pipeline, search for the matched routes in the static routing table based on the requested url.
3. Call the PR () method without vcHandler between events 11th and 12, and find the corresponding controller Class Based on the matching results.

 

0. The browser sends a request:/User/UserHome/Index
1. When the website is started, Application_Start () will be called first. Then, the region route will be registered when the website is started.
[When the website starts, first go to the bin folder under the root directory of the website and find the region registration class that inherits the AreaRegistration class,
Create the objects of these classes and call its RegisterArea () method to complete region route registration]
2. Then, in the event pipeline, go to the static routing table based on the requested url and find the matched route: User/{controller}/{action}/{id}
3. Call the PR () method without vcHandler between events 11th and 12, and find the corresponding controller Class Based on the matching results, that is, class UserHome. cs.
3.1 because we specified the namespace to be searched when registering the region route, and then found
[If this parameter is not specified, the namespace of the region registration class is used by default]
4. After finding the Controller class, create the Class Object and call its Index method.
5. The Controller specifies the called View. The ViewResult object is returned when the View () method is executed.
[Action method, but creates a view object and does not load the view]
5.1 then call the ExcuteResult () method of the ViewResult object
5.2 search for the corresponding view engine [this time the Razor engine is used], and find the corresponding view through the view Engine

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.