The Web API is an application interface framework that can build HTTP services to support the framework of a wider range of clients (including mobile devices such as browsers, phones, and tablets), an ASP that is used to build RESTful applications on the. NET Framework The ideal platform for sequencing. This article mainly introduces the framework design of ASP, but not limited to the whole Web API application architecture. NET of technology.
1, the core layer design of the Web API
From what we can see, the entire perimeter of the application is built around the core of the Web API, and if we put it in a different way, then that is the design diagram below, we use the app, app, web App, WinForm app as the web API interface layer above an interface application layer to deal with, this is based on an API interface layer, access to multiple or multiple ways of interface application layer, so as to build enterprise rich data service applications.
As the Web API layer as a common interface layer, we are very good to ensure that the interface application layer of data consistency, if considering the response of integrated processing, we can even put the application, app, Web application layer a set of Web programs, even in order to take advantage of their own application of the particularity, These applications can also be done very similar, so as to provide users with a unified interface representation, greatly improve the user interface experience effect, the user almost no need for additional interface learning, you can be familiar with the entire application system of the various modules.
Under the entire WEBAPI can be through the business logic layer to consolidate data storage and external interface access to two parts of the work, that is, the data access layer, the external interface layer such a hierarchical concept, if extended, we can also provide customers with some files, pictures, videos and other data storage, similar multimedia API interface , so that the interface layer of the entire Web API can provide a rich data interface for all incoming clients, thus enabling powerful and flexible access.
It is mentioned that if we consider the integrated processing of the response, we can even put the application, app, Web application layer a set of Web programs, in fact, the app layer can be divided into two types, one is the native app type, using native language such as Object C to develop iOS applications, Using Java to develop native apps for Android, there is a native framework that encapsulates a portal + Background responsive Web page, as shown in.
Compared to native applications, using the Portal Framework + responsive page, development efficiency is very fast, upgrade maintenance costs can be reduced a lot, compared to web development is much faster than using the original app development.
From the above architecture analysis, our web API as a core layer, can be developed on the above our various enterprise business applications,
In the current more popular member management, customer management and other aspects, combined with the application of catalysts, you can do more in line with the mobile trend, so as to achieve our "Internet +" application landed.
2. Application of Web API layer in WinForm hybrid framework
Also, in the WinForm interface, we can access the data service of the Web API in addition to direct access to the database and access to the distributed WCF service. The model is built into a more adaptable and powerful hybrid development framework.
Security is convenient, direct access to the database, not on the network public interface, they are only in a single or LAN security environment, so just to ensure the security of the database, you can generally be encrypted by the connection string to achieve a certain limit.
The security of WCF services can be verified by X509 certificates, and can also be checked with custom user names, password authentication methods, and so on.
For the Web API, because it provides a stateless interface access, and often the Web API for a variety of client access needs, may need to publish on the public network for access, so we need to pay more attention to the security of the Web API interface layer, which we described in detail later.
That is, the new hybrid development framework, in addition to the traditional mode of direct-attached database access, WCF distributed access to the WCF service access mode, you can also access the API distributed access to the Web API interface mode, their relationship constitutes a complete WinForm application system, as shown in.
Here is my diagram based on the traditional Access database approach and the distributed WCF data service access approach, around the core of the hybrid framework, we can build a lot of loosely coupled modules, This enables us to provide greater development efficiencies for the development integration of our WinForm applications.
The hybrid framework can be seen as an advanced version of the WinForm framework, except that it is itself a complete business system, with all the accessible modules on its periphery (such as universal permissions, universal dictionaries, universal attachment management, General Staff management ...). Have implemented this hybrid framework, so the use is very convenient, if the whole framework is simplified, it is in the original WinForm interface layer, with the interface call mode, to avoid the tight coupling relationship with the business logic class. Because it is called through an interface, it can be configured to specify an implementation that points to WCF, so it also encompasses all the features of the WCF framework. After completing the development of the Web API layer, the integration based on the Web API layer is my next stage of work.
We further analyze the implementation details of the hybrid framework, the traditional WinForm Access database and the way WCF services are accessed through a configuration module to determine whether to take direct access to the database, or to access the WCF services, they are unified to a facade interface façade layer, If you take into account the Web API layer, based on a hybrid architecture, that is, the interface on the façade layer of the facade interface to add more than one Web API to encapsulate. The architecture diagram for the specific entire framework is shown below.
Reference page:
Http://www.yuanjiaocheng.net/webapi/parameter-binding.html
Http://www.yuanjiaocheng.net/webapi/action-method-returntype.html
Http://www.yuanjiaocheng.net/webapi/web-api-reqresq-format.html
Http://www.yuanjiaocheng.net/webapi/media-formatter.html
Http://www.yuanjiaocheng.net/webapi/webapi-filters.html
WEB API Application Architecture Design Analysis (1)