Some designs of the "routing" section in your "Mono" Project

Source: Internet
Author: User

Anyone familiar with ASP. NET should know that ASP. NET's routing system has two major functions:

1) Check the URL of a request and infer the action on the Controller to be called.

2) generate an output URL.

In the Mono Project, I defined a route publishing system (also known as the routing Supply Module) to allow my routes to contain various data and functions, such as priorities, add some data to datatokens, instead of providing it when defining the route, and create a new icontainer lifetiemscope every time the request arrives. At the end of processing the request, the lifetiemscope is automatically released ., however, as long as the "irouteprovider" interface is implemented for subsequent route registration, the application can automatically add the route to the global route table.

Basic design class diagram of this module

This module features:

1. You need to register a route and implement a class from the irouteprovider interface.

2. You can create a new route publisher from the iroutepublisher interface to provide your own route publishing program.

3. Although the custom route (monoroute) is defined ). In fact, this is the decorator mode mentioned in the design mode, which encapsulates an actual routebase object. That is, a route object provided by the irouteprovider interface.

4. Custom routehandler, httphandler, and httpasynchandler are also encapsulated objects actually used in MVC, such as routemvchandler.

It mainly provides some actions for getting data from the IO container and releasing resources.

Some designs of the "routing" section in your "Mono" Project

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.