Asp. NET Development e-commerce website learning experience

Source: Internet
Author: User
Tags net string access

The previous array of "Pro asp.net 2.0 E-Commerce in c#2005" edited a business system website, want to sum up the learned knowledge.

The site features a general business website

Here, let's talk about his frame.

Data Access Layer

Using the stored procedure to manipulate the storage of the database, there is a Shop.dataaccess class library dedicated (note that I'm here to change the original namespace to shop)

The class library uses a component to encapsulate operations on the database for Microsoft Data Access Application Block, which is simply copying SQLHelper.cs to the class, which automatically manages the connection, parameters, and names of stored procedures.

The Dataaccessbase class under the class library is a base class that almost all classes inherit, with two attributes, one stored procedure, and the connection string that returns the database.

Note: This is a string from the Web.config file that connects to the database, but cannot be referenced to the Configuration class in the class, so we want to add the additional reference System.Configuration.dll assembly

The following are the referenced contents:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Configuration;

Namespace Shop.dataaccess
{
public class Dataaccessbase
{
Name of the stored procedure
Protected string StoredProcedureName {set; get;}

Get connection string
Protected string ConnectionString
{
Get
{
return configurationmanager.connectionstrings["Db_shopconnectionstring"]. ToString ();
}
}
}

}

Storeprocedure Class in class library

Stored Procedure names written using enumeration storage to make it easier to change and manage

But for a lot of stored procedures, a class to store is certainly not enough, personal recommendations in the subdivision, control a class of stored procedures not more than 20

For example:

Storeprocedure_user,storeprocedure_product,storeprocedure_orders

The following are the referenced contents:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;

Namespace Shop.dataaccess
{
public class StoredProcedure
{
public enum Name
{
Productbyid_select,
Products_select,
Products_selectserach,
Shoppingcart_select,
Shoppingcart_insert,
Shoppingcart_update,
Shoppingcart_delete,
Enduser_insert,
Enduserlogin_select,
Address_select,
Contactinformation_select,
Adminlogin_select,
Product_insert,
Productcategory_select,
Product_update,
Orders_select,
Orderdetails_select,
Orderall_select,
Orderstatus_select,
Ordersbyid_select,
Orders_update,
Productpromotion_select
}
}
}



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.