2.0+sql Server2005 to build multilayer applications

Source: Internet
Author: User
Tags new features visual studio

With the release of. NET 2.0, Web applications built with 2.0来 will be made easier. With 2.0 and SQL Server 2005, it will be easier to build a multi-tier architecture Web application than 1.1. In this article, you will build an example of a simple multi-tier application using 2.0 and SQL Server (. NET) using the April CTP version using Visual Studio 2,sql Server 2005. Some of the new features in NET 2.0 and SQL Server 2005, such as Objectdatasource,master pages,clr stored procedures, TableAdapter wizards, and so on.

Introduction to Multilayer Applications

What is the application of multi-tier architecture? The traditional CLR pattern is a typical example of a two-tier application, the client/server model. This mode is only a two-tier architecture, the client issues a request to the server, the server will handle a large number of requests from the client, after business logic operation and processing, and then return to the client. The two-tier architecture model clearly does not meet the modern internet-trend enterprise computing processing requirements, because of its deployment, load balancing processing is very cumbersome, so there are three-tier architecture and even multi-layer architecture appears. The core idea of multi-layer architecture is that the whole business application is divided into presentation layer-business layer-data access Layer-database, which divides the client's presentation layer, business logic access, data access and database access clearly, which is beneficial to the development, maintenance, deployment and extension of the system. Here's a typical example of how to build a multi-tier application using 2.0 and SQL Server 2005来.

Our example is simple enough to illustrate the problem. Our application has only two pages, the first page will call the author table of the pubs database in the SQL Server 2005 database, list all the authors, and then click on each author's link to show which books the author has written.

The following figure illustrates our architecture for this multi-tier application under the 2.0 architecture:

As we can see from the above illustration, we will build this multi-tier application in this way. First of all, looking at the top of the graph, the blue part is the presentation layer, the appearance of our web application, the layer directly dealing with users, such as processing input and output, in 2.0, we can use the Master page template technology, To build a page that is consistent in its appearance style (which is mentioned below). Next is the business logic layer, which typically handles business logic and related calculations directly in the layer, and in 2.0 we can easily handle the business logic layer by using the ObjectDataSource control.

The business logic layer then deals with the data access layer (layer). The role of the data access layer is to separate all the related process business of database operation, when the structure of the database changes, only need to modify the code of the data access layer, no need to modify other places, it will be convenient and different database to deal with. In 2.0, by using the TableAdapter Data Wizard, you can quickly generate data access layer code from existing databases, and basically do not need to write any code.

Finally, we create a stored procedure by using the new SQL Server 2005 feature: The CLR stored procedure (CLR stored procedure). In SQL Server 2005, you can use your familiar. NET language to create a stored procedure.

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: 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.