Business expansion: three-tier architecture and three-tier architecture

Source: Internet
Author: User

Business expansion: three-tier architecture and three-tier architecture

1. What is the three-tier architecture first to see the title?

The three-tier architecture is actually:

① Presentation layer: receives user input and presents the output to the user,

And access security verification, and correctness of the input data,

Validity and presentation style, but correctness of output data

Not responsible.

② Business logic: Responsible for the processing of business in the system field, for the production of logical data,

Processing and conversion. Correctness and

Effectiveness and responsibility, but for the output of Logical Data and user data

Correctness is not responsible, and data presentation is not responsible.

③ Data access layer: Responsible for interaction with data sources, that is, data insertion, deletion, modification, and

Read data from the database, but the correctness and validity of the data

No responsibility, no understanding of the purpose of data, and no business logic processing.

 

The above three are three layers of architecture. Below I use graphics to clearly show the relationship between the three.

 

Dependencies between layers

 

Changes in layer-3 Architecture

The first question is the foundation. I hope you will keep it in mind.

 

 

2. Advantages of a three-tier architecture:

① Narrow down developers' attention Scope

② Lossless replacement

③ Reduce dependencies between system modules and improve code reusability

 

Disadvantages:
① Reduces the system performance. This is self-evident. If the hierarchical structure is not used,

Many businesses can directly access the database to obtain the corresponding data, but now it must be done through the middle layer.
② Sometimes it may cause cascade modifications. This kind of modification is especially reflected in the top-down direction.

If you need to add a function in the presentation layer to ensure that the design conforms to the hierarchical structure,

You may need to add the corresponding code in the business logic layer and data access layer.
③ Added the amount of code and workload.

 

3. ADO. NET Transaction Processing

The execution of the ADO. NET transaction involves four steps:

① Call the BeginTransaction () method of the SqlConnection object. (open the database connection before calling this method only. Otherwise, an exception will occur)

Create a SqlTransaction object, marking the start of the transaction.

② Assign the created SqlTransaction object to the Transaction attribute of the SqlCommand to be executed.

③ Call the corresponding method to execute the SqlCommand.

④ Call the Commit () method of SqlTransaction to complete the transaction, or call the RollBack () method to stop the transaction.

This is the most basic. you must first understand the knowledge before you can better understand the 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.