Web API application architecture design analysis (1), api Architecture Design

Source: Internet
Author: User

Web API application architecture design analysis (1), api Architecture Design

Web API is an application interface framework that can build HTTP services to support a wider range of clients (including browsers, mobile phones, tablets, and other mobile devices). ASP. NET Web API is.. NET Framework. This article mainly introduces the design of the entire Web API application architecture based on the ASP. NET Web API framework, but not limited to. NET technology.

1. Core Layer Design of Web APIs

In the current developed application scenarios, we often need to access Winform clients, APP programs, website programs, and currently popular applications. Such data should be provided by the same service, this is the Web API platform we need to build. Based on the above requirements, many enterprises need to design the entire enterprise application system with the Web API priority concept. As the core of the entire bond, Web APIs must take uniformity, stability, and security into account at the core layer.

 

We can see that the entire peripheral application scenario is built around the core layer of the Web API. If we express it in another way, that is, the design diagram below, we process applications, APP applications, Web applications, and Winform applications as an interface application layer on the Web API interface layer. This is based on an API interface layer, access Multiple or multiple interface application layers to build a wide range of data service applications for enterprises.

As the Web API layer acts as a public interface layer, we can ensure data consistency at the application layer of each interface. If responsive integration processing is taken into account, we can even layer applications, APP applications, and Web applications into a set of Web programs. Even in order to take advantage of the particularity of their respective applications, these applications can be very similar, in this way, the user is provided with a unified interface representation, which greatly improves the user experience, and almost no additional interface learning is required, you can be familiar with the use of each module of the entire application system.

The distributed WCF Service can also be used to access data services of Web APIs, thus forming a hybrid development framework with wider adaptability and more powerful functions.

Secure and convenient, direct access to the database, without making public interfaces on the network, they only run in a single machine or LAN security environment, so you only need to ensure the security of the database, generally, you can implement certain restrictions by encrypting the connection string.

The security of the WCF Service can be verified by using the X509 Certificate, or by using a user name or password.

For a Web API, because it provides a stateless interface for access, and often Web APIs are generally required for access from multiple clients, they may need to be published on the public network for access, therefore, we need to pay more attention to the security of the Web API interface layer, which will be detailed later.

That is, the new hybrid development framework. In addition to the traditional mode of direct database access, the WCF distributed access mode can also be connected to the Web API interface mode of distributed API access, their relationships constitute a complete Winform application system, as shown in.

The following figure shows my module analysis diagram based on the traditional database access method and the distributed WCF data service access method. We can build many loosely coupled modules around the core of the hybrid framework, in this way, we can provide higher development efficiency for the development and integration of Winform applications.

The hybrid framework can be regarded as an advanced version of the Winform framework. Apart from being a complete business system, all auxiliary modules on its periphery (such as general permission, general dictionary, general attachment management, general personnel management ....) This hybrid framework is implemented, so it is very convenient to use. If the whole framework is simplified, it is the original Winform interface layer that uses the interface call method, avoid tight coupling with the business logic class. Because it is called through an interface, it can be configured to point to the implementation of WCF, so it also covers all the features of the WCF framework. After developing the Web API layer, integration based on the Web API layer is my next step.

 

We further analyzed the implementation details of the hybrid framework. The traditional Winform Access database and WCF Service access method was originally considered. It was determined that the database access method was adopted through a configuration module, or access to the WCF Service. Both of them are unified to the Facade layer of a Facade interface. If you consider the Web API layer, based on the hybrid architecture, that is to say, you can encapsulate one more Web API interface on the Facade layer of the Facade interface. The architecture of the entire framework is as follows.

 

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.