Three-layer structure development mode of ASP. NET

Source: Internet
Author: User

ASP. NET It has been around for several years, but the traditional development model is still used. Form Mode, not mature MVC architecture support. The disadvantage of this mode is obvious. Code has low reusability and poor scalability, which makes it difficult to modify and maintain code in the future.

for development purposes, I designed a MVC

MVC the mode structure is as follows:

  

 

 Code 
Using System;

Using System. text;

Using System. Data;



Namespace Accesshelper

{

Public Interface Ihelper

{

Datatable executereader (
String Connectionstring, commandtype connector type, String Plain text );

Int Executenonequery ( String Connectionstring, commandtype connector type, String Plain text );

Object Executescalar ( String Connectionstring, commandtype connector type, String Plain text );

Void Addparameter ( String Key, Object Value );

}

}

 

dbhelper module ihelper the interface is defined as follows:

Ihelper For direct execution SQL Statement. The three main methods are based on Command Objects are divided by three methods. Where Executereader The method returns Datatable Type, use Dataadapter Data Fill To Datatable . The advantage of doing so is to disconnect the database as soon as possible and release resources.

Dbdao The module depends on the specific Model Class. Its function is Dbhelper Come on Datatable Convert to a specific class. Dbdao PASS Parameters Databasetype Parameter, use Dbhelperfactory The factory class instantiates the corresponding Ihelper Class.

dbdal the module is used to process various data access logics, such as logon and registration.

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.