I'm implementing a new layered architecture for my companies product and would like any critiquing on it. I want it to be a standard layered architecture and follow common practices. I was unclear about the naming of some of the objects
like "entities". I wasn't sure if "data transfer object" or "custom type" fit better. This is a very simple example of my customer object and I was wondering if i had over 50 properties, how I should handle them with a grid? I would only need about 5 fields
when binding the customer objects. At any rate, please let me know your thoughts on this.
//************************************************************************
//- Business Entity
//************************************************************************
namespace MyCompany.Entities
{
public struct Customer
{
private int _intCusId;
private string _strCusName;
public int CusId
{
get
{
return _intCusId;
}
set
{
_intCusId = value;
}
}
public string CusName
{
get
{
return _strCusName;
}
set
{
_strCusName = value;
}
}
MyCompany.Entities.Customer entCus = new MyCompany.Entities.Customer(5674, "John Smith");
MyCompany.BL.Customer blCus = new MyCompany.BL.Customer();
blCus.UpdateCustomer(entCus);
//************************************************************************
//- Business Layer
//************************************************************************
ryanoc
Member
300 Points
138 Posts
Critique Implementing a Layered Architecture
Sep 20, 2007 12:43 PM|LINK
//**************************************
//- Business Entity
//**************************************
namespace MyCompany.Entities
{
public struct Customer
{
private int _intCusId;
private string _strCusName;
public int CusId
{
get
{
return _intCusId;
}
set
{
_intCusId = value;
}
}
public string CusName
{
get
{
return _strCusName;
}
set
{
_strCusName = value;
}
}
public Customer(int intCusId, string strCusName)
{
this._intCusId = intCusId;
this._strCusName = strCusName;
}
}
}
//**************************************
//- Presentation Layer
//**************************************
MyCompany.Entities.Customer entCus = new MyCompany.Entities.Customer(5674, "John Smith");
MyCompany.BL.Customer blCus = new MyCompany.BL.Customer();
blCus.UpdateCustomer(entCus);
//**************************************
//- Business Layer
//**************************************
public void UpdateCustomer(MyCompany.Entities.Custom
{
try
{
SqlParameter[] sParams =
{
MyCompany.Helper.SQLParams.MakeInputPara
MyCompany.Helper.SQLParams.MakeInputPara
};
MyCompany.Helper.DBIO.ExecuteNonQuery("s
}
catch
{
throw;
}
}
//**************************************
//- Data Access Layer
//**************************************
namespace Helper
{
public class DBIO
{
public static DataTable ExecuteNonQuery(string strSQL, SqlParameter[] sParams, SqlConnection cn)
{
//standard sql execution
}
}
}
Class Design OOP N-Tier C# C# class design OOP Maths 3-Tier Architecture
iNetspace.com