1-tier 3-layer Architecture using a Domain Model
Based on the above class diagram, we will create a new simple 3-layered application using the entities defined in the above domain model. We will create a new ASP.NET Web Project in VS. This time, you should create two new folders inside your root web folder (using the Add New Folder option in VS):
BL: This folder will contain all of the business logic domain classes
DAL: This folder will contain the data access code files (for each entity)
Layer 1: Data Access Layer (DAL)
First, we will create a DAL class for each entity. We will name each DAL class using this naming pattern: EntityDAL. Let us see the CustomerDAL class:
using DomainModel.BL; namespace DomainModel.DAL { public class CustomerDAL { public static void AddCustomer(Customer cs) { using (SqlConnection con = new SqlConnection(SQLHelper.GetConnectionString())) { SqlParameter[] par = new SqlParameter[4]; par[0] = new SqlParameter("@customerID", cs.ID); par[0].Direction = ParameterDirection...