DAL should be independent from BL and BL dependent on DAL. Your UI should only Access data via BL. Its good practice if you return DataTable or DataRow from DAL and then Convert DataTable/DataRow into BL object(s). When your UI needs to access the data it can access from BL. So UI will independent from column name and Database type(SQL Server, Oracle..). This way your UI will totally independent from DAL. Personally I prefer class name like "CustomerBL", Don't use the BL word in the begging of class name.
Below see Sample Code.
//Customer Class
class BllCustomer
{
public int CustomerId { get; set; }
public String Name { get; set; }
public BllAddress Address { get; set; }
public static BllCustomer GetByCustomerId(int id)
{
DataRow dr = DalCustomer.GetByCustomerId(id);
if (dr == null)
return null;
BllCustomer oCust = new BllCustomer();
oCust.CustomerId = int.Parse(dr["CustomerId"].ToString());
//Do for other class members and load values
return oCust;
}
}
class DalCustomer
{
public int CustomerId { get; set; }
public String Name { get; set; }
public int AddressID { get; set; }
public static DataRow GetByCustomerId(int id)
{
//Get Data row from Database and return Datarow
DataRow CustomerRow = GETFROMDATABASE("SELECT * from CUSTOMER");
return CustomerRow;
}
}