ASP. NET has been available for several years, but the traditional Form mode is still used in the development mode, without the support of mature development modes. The disadvantage of this technology is obvious. The Code has low reusability and poor scalability, which makes it difficult to modify and maintain it in the future.
For the purpose of development, I have designed an ASP. NET development mode. Let's talk about it and discuss it. If the design is poor, please kindly advise.
An example of the three-tier architecture of ASP. NET development mode is as follows:
- using System;
- using System.Text;
- using System.Data;
- namespace AccessHelper
- {
- public interface IHelper
- {
- DataTable ExecuteReader(string connectionString, CommandType cmdType, string cmdText);
- int ExecuteNoneQuery(string connectionString, CommandType cmdType, string cmdText);
- object ExecuteScalar(string connectionString, CommandType cmdType, string cmdText);
- void AddParameter(string key, object value); }
-
- }
The IHelper interface of DbHelper module is defined as follows::
IHelper is used to directly execute SQL statements. Its three main methods are divided based on the three methods of the Command object. The ExecuteReader method returns the DataTable type, and uses DataAdapter to Fill the data to the DataTable. The advantage of doing so is to disconnect the database as soon as possible and release resources.
The DbDAO module is defined based on a specific Model class. Its function is to convert the DataTable from DbHelper to a specific class. DbDAO uses the DataBaseType parameter to instantiate the corresponding IHelper class using the DBHelperFactory factory class.
The DbDAL module is used to process various data access logics, such as logon and registration.
This is a simple ASP. NET design mode. Using a three-tier structure on the basis of this mode can facilitate project development and code maintenance.
- Use AJAX in ASP. NET
- Compatibility between the WCF Service and ASMX service in ASP. NET
- Explore new ASP. NET technologies for more convenient Web development
- Using usage in ASP. NET
- Analysis of health monitoring in ASP. NET project development