I was wondering if someone could help me.
I Have a n-tier application and each layer is a class lib. DAL -> BLL -> PL Data Access Layer -> Business Logic Layer -> Presentation Layer
In my PL i Need to reference my wrapper class "Shippers" from the DAL however i want to remove the dependency to my DAL and make it go through my BLL. This forces me to have a duplicate class of my shippers in my BLL.
However How would i link two of the same classes in 2 different Libs? I also have no clue of what the term of duplicating the same classes is known as?
Here is my Shippers Class
public class Shippers
{
public int ShipperID { get; set; }
public string CompanyName { get; set; }
public string Phone { get; set; }
}
In that case, use
Composition
technique and in yourBLL
project add the dll reference of the library which containsShippers
class. Bll class have the Shipper as member field and expose a public property/method which returns a instance ofShipper
and access the same from yourPL DAL
. Like below:BLL Project
PL DAL Project