Service layer and data layer Automatic Code Generator dohope. Net (. NET 1.1 and. NET 2.0 are both common)

Source: Internet
Author: User
Object relational mapping (ORM for short). I believe everyone should be familiar with it. It is a technology designed to solve the mismatch between object-oriented and relational databases. Using the O/R Mapping mode to develop database applications can save a lot of work, especially the compilation of cumbersome SQL statements. Of course, using the O/R Mapping technology also has its disadvantages, is things always imperfect!

The o/R Mapping technology implemented by the dohope. Net generator also generates code at the business layer and data layer based on actual project factors, saving a lot of time for development and management information systems.

Note that the database table must have a primary key. Version V 1.0 (SQL version) is now released. You are welcome to provide bugs during use.Download the dohope. Net Generator
 
Code Generator interface:


The following is a test project with a three-tier architecture. The bll and Dal layers are automatically generated for the code.

The following are some simple examples:

Configure global. asax. CS (database connection and type) as follows:

Protected void application_start (Object sender, eventargs E)
{
String connectionstring = system. configuration. configurationsettings. appsettings ["sqlconnectionstring"]. tostring ();
TS. Dal. database. connectionstring = connectionstring;
TS. Dal. database. databasetype = ts. Dal. databasetype. sqlserver;
}

Example of adding a record:

City Ct = New City ();
Cityrow Cr = CT. createrow ();
Cr. ID = city. getnextid ("");
Cr. cityid = This. textbox6.text. Trim ();
Cr. City = This. textbox5.text. Trim ();
Cr. Father = This. textbox4.text. Trim ();

Ct. Save ();

Example of modifying a record:

City Ct = New City (convert. todecimal (this. Key. Text ));
CT [0, 0]. cityid = This. textbox1.text. Trim ();
CT [0, 0]. City = This. textbox2.text. Trim ();
CT [0, 0]. Father = This. textbox3.text. Trim ();

Ct. Save ();

Example of deleting a record:

City Ct = New City (convert. todecimal (this. Key. Text ));
Cityrow Cr = CT [convert. todecimal (this. Key. Text)];
Ct. Delete (CR );

Query read data:

City Ct = New City (convert. todecimal (I ));
This. textbox1.text = CT [0, 0]. cityid;
This. textbox2.text = CT [0, 0]. City;
This. textbox3.text = CT [0, 0]. Father;
This. Key. Text = CT [0, 0]. Id. tostring ();

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.