Analysis of ASP. NET three-tier architecture (original)

Source: Internet
Author: User

Data Development in asp.net, using a three-tier architecture can improve code readability and function scalability. First, let's look at a figure:

We all know that it is the performance Layer (PL), business logic layer (BLL), and data access layer (DAL ). Their responsibilities are as follows:

 

1.1.1 Web presentation layer (PL) functions:

Provides users with the application system user interface and functions.

Implementation

1) Interface Design:

Use the parent page, Server Control, user control, webpage, and css style sheet to control and implement the settings. For details, see section 2.4 user interface.

2) functions:

Server Control: implements common functions of the template;

User Control: implements some common components (such as the selection box ).

1.1.2 business logic layer (BLL) functions:

Provides all database operations. Including: Returning data sets from the database, updating data to the database, and undertaking some data verification functions.

Implementation:

The data intermediate layer component is a. CS file, and database access operations are stored in the APP_Code package. All types of static methods should be provided, and data entity classes and intermediate layer data transmission classes should be stored in the APP_Code package.

1.1.3 database access layer (DAL) functions:

It mainly provides data storage and query functions, and must undertake some data verification functions. The code for database operations is generally written here, for example, the code for executing SQL statements and stored procedures (DBHelper.

Implementation:

Define the connection string in the Web. Config configuration file to access the database. Call some encapsulated class methods under. net.

Of course, if the project is large, you can also write the model layer. This is better.

Share my source code with you if you have time.

If you want to, I can send it to you!

Source code

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.