ABP Source Code Analysis 36: ABP.WEB.API

Source: Internet
Author: User

The content here is not related to ABP dynamic Webapi. In addition to dynamic WEBAPI,ABP is bound to support the use of traditional webapi. Abp. The Web.api module implements some basic agreed-upon functions to facilitate the creation and use of ASP. WebApi.

Abpapicontroller: This is an abstract base class that inherits from Apicontroller and is the base class for all controllers in the AB WEBAPI system. In this case, it encapsulates most of the feature objects provided in the ABP core module. At the same time, some common methods are implemented. It has four derived classes: Dynamicapicontroller<t>,typescriptcontroller,abpcachecontroller,abpserviceproxiescontroller.

Apicontrollerconventionalregistrar: All Abpapicontroller derived classes are register in the container of the ABP system

httpparameterbindingextensions: The extension method of the Httpparameterbinding class to determine whether a method parameter is evaluated from a URI.

Abpapiauthorizeattribute: Implements the Iabpauthorizeattribute, inherits the Authorizeattribute of ASP. It encapsulates the permissions and requireallpermissions for configuring permissions, and it overrides the IsAuthorized method for implementing the authorization check logic of the ABP.

abpremotecallexception: Inherit abpexception. Used to encapsulate the exception that ABP Webapi returns to the client (C #).

iabpwebapiclient: Defines the interface that accesses the ABP Webapi.

abpwebapiclient: Implements the method defined in Iabpwebapiclient to access the ABP Webapi. It internally accesses Webapi by encapsulating the httpclient, and then returns the corresponding results to the client based on the response of the remote API.

The following two methods are used to convert a CLR object to a JSON object, or to convert a JSON object to a CLR object. It seems superfluous to convert the CLR object to a JSON object, as defined here, because the author has defined an extension method of object in the ABP core framework to convert the CLR object to a JSON object.

Abpcachecontroller : Inherited from Abpapicontroller, used to clean up the cache (clear and ClearAll).

Clearallcachemodel : There is only one password property.

Clearcachemodel: There is a password attribute and an array of cache ' s name to be emptied

Clearcachesettingprovider: Note that the method of cleaning up the cache first verifies the password and clears the cached password in setting configuration to the ABP. Clearcachesettingprovider provides an initial password for this setting, which is hard-coded into the code, such as:

That is, you can use this password to empty the cache of any site that has been developed by using the ABP template (without re-setting this password). It is recommended that you reset This password in the Web. config.

Wrapresultattribute: This attribute is used to annotate how WEBAPI encapsulates response. For example, Wraponerror indicates that the error message is encapsulated in response back to the client. The Logerror ID logs the error message to the log.

httpactiondescriptorhelper: Gets the Wrapresultattribute of the Controller or action through the action's httpactiondescriptor.

Abpexceptionfilterattribute: Inherit from Exceptionfilterattribute, rewrite onexception, To implement a custom exceptionfilter: Determine whether to log or trigger events via Eventbus based on the wrapresult labeled on the action

Dynamicapiclientbuilder,iapiclientbuilder<tservice>,apiclientbuilder<tservice>, Dynamicapiclientbuilder: Not implemented, temporarily ignored.

Httpverbextensions:httpverb extension method for comparison with HttpMethod.

Back to ABP source Analysis series Articles Directory

ABP Source Code Analysis 36: ABP.WEB.API

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.