MS.NET development three-layer structure application

xiaoxiao2021-03-06  61

Traditional two-layer structure has been widely used in the past application system development. It is characterized by that application logic is usually distributed at both ends of the client and server, and the client issues a data resource access request, and the server side returns the result to the client. However, there is a lot of architectural problems in the Client / Server structure, such as: When the number of clients surges, the performance of the server is greatly attenuated because the load is overweight; once the application needs changes, the client and server application are all applications. Need to make changes, bring great inconvenience to application maintenance and upgrade; a large number of data transfer adds a network load, and the like.

The three-layer structure describes the so-called three-layer architecture, which has added a "intermediate layer" between the client and the database, also called the component layer. The three-layer system mentioned here is not a physical three-layer, not simply placing three machines is a three-layer architecture, not only B / S is the three-layer architecture, and the three layers are logical. Three layers, even if these three layers are placed on a machine. The application of the three-layer system puts the business rules, data access, legitimate checks, etc. in the intermediate layer. Typically, the client is not interacting with the database, but is established with the intermediate layer via the COM / DCOM communication, and then interact with the database via the intermediate layer. ASP.NET is just part of .NET. Its biggest advantage In addition to being compilation execution speed, I think the biggest advantage is that the page and code separation is written (the effect is like the FORM design interface in Delphi and the processing code separation), which is used by our Rad Tools. People are not a gospel. Coupled with the various web controls provided by the .NET library, and compared to the previously written webpage method. With the gradual maturity of distributed object technology, multi-layer distributed application architecture has been applied more and more applications. The application system only has to solve the problem of the Client / Server structure in the application. Under the multilayer architecture, the application can be distributed on different system platforms, and communication with inter-heterogeneous platforms can be implemented by distributed technology. Integrate application systems over distributed systems, which greatly improves system scalability. In multi-layer distributed applications, a layer or multi-layer application service program is added between the client and the server, which is called "Application Server". Developers can put the application's business logic on the intermediate layer application server, separate the application's business logic to the user interface. Provide a simple interface to the user with the premise of ensuring the client function. This means that if you need to modify the application code, you only need to modify the intermediate layer application server without modifying thousands of client applications. This allows developers to focus on the analysis, design and development of application system core business logic, simplifying the development, update, and upgrade of application systems. Microsoft.net is prepared for the three-story structure Microsoft .NET Framework is a set of next-generation development platforms in Microsoft. .NET is based on developer's perspective. It is a public platform library (FCL), including nearly 5,000 categories of nearly 100 namespaces, think about it is much powerful, including a public Language Runtime (CLR). Because as long as it meets the public operating specification of .NET (CLS language can use the powerful class it provides, compiling as Microsoft's Intermediate Language (MSIL), you can be called as a component in other applications. All Benefits Brought by Public Operations: Garbage Automatic Recycling (GC), Real-Time Compile (JIT), Cross-Language Interaction, Cross-platform. Net is also comparable to the operating system to provide the developer-oriented API. ASP. Net is part of .NET. Its biggest advantage In addition to the compilation execution speed, I think the biggest advantage is that the page and code separation is written, plus the various web controls for the support event provided by the .NET library, As well as the .NET public platform class library (FCL), and compared to the previously prepared web page, it is a revolution. Use the ASP.NET to deploy the three-story architecture ASP.NET can be quickly and convenient to deploy three-layer architecture .asp .asp The change in .NET revolution is to use an event-based processing in the web page, which can specify the background code file for processing. You can use C #, VB, J # as a language of the background code .. NET can easily implement the assembly, background The code can easily use your own defined components through the naming control. The display layer is placed in the ASP page, which is very convenient to implement the three-layer architecture.

The following is a small example of making a message book on the implementation of each layer. We first build a database GESTDB in the SQLServer database, in GESTDB, Table Geustbook (ID Int (4) Unique Not Null, Name Varchar (20),

Content Text, Primary Key ID);

Step 1: Open vs.net, click File - "New -" Blank Solution, select Visal C # items in the pop-up project, template Select the ASP.NET web application. Name the scenario geustbook at the location. As shown below. Step 2: Construction Database Access Controls. Click "OK" above. On the "Solution Explorer" in the window, right-click "Solution" Guestbook "Select Add" -> New Project ", pop up the following window, select the class library, fill in the name, location. Note that the class library is theoretically related to the project of the message book, so the storage location can be arbitrary. Step 3: Establish a logical processing layer. Together with the second step, establish another control businesslayer. This control is used to invoke database controls, encapsulate all logical processes of the message book. As shown below. Step 4: About the reference. Because Businesslayer is to use the system's web control and just built DBLAYER, you must add the reference to the two. Right click on BusinessLayer's "reference", select "System.Web.dll" double-click the .NET "DBLAYER" double-click the item. Step 5: Connect the GuestBook ASP.NET project with the logical layer, and use the added reference. Note: DBLAYER has been referenced in Businesslayer, you can only quote BusinessLayer at the GuestBook. Now your GuestBook Solution Explorer should be as shown below: If not, please check if you have an error. Through the above steps, the three-layer architecture of ASP.NET has been successfully deployed. At the Guestbook layer we placed the App ASP page, in the Businesslayer layer, we implement all the business logic code at this layer. The Datalayer layer mainly processes the operation of the database for the BusinessLayer layer. The three-layer structure of the three-layer structure can be successfully implemented as long as the specific class is implemented in each layer. Summary: This paper briefly describes the software system idea of ​​the three-layer architecture. The specific implementation method of deploying three-layer structure with MS.NET is mainly introduced by an example of a message book.

Author: SUN Movement

转载请注明原文地址:https://www.9cbs.com/read-113533.html

New Post(0)