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