I’ve got my DL project abstraction (seperate assmebly for my DL) I’ve got a BL (seperate assembly)..where it’s got intermediate methods that are calling some db layer methods. But some of those DL methods need to return a type that’s in my BL…that would force a problem, a circular reference. How are you handling this in terms of patterns?
so for instance if I have a hypothetical MyProject.DL has the following method in the Car class:
internal List<Car> GetCars(Dealer dealer)
{
// logic
}
and MyProject.BL needs to call that DL method:
public List<Car> GetCars(Dealer dealer)
{
MyProject.DL.GetCars(dealer);
}
I’d personally separate it out so I had three assemblies:
I’d put any shared types in the
My.Project.Typeslibrary, as long as they contained no logic of their own and were only populated/manipulated by methods in the DL and BL libraries.For example:
In
My.Project.TypesNow both
My.Project.DLandMy.Project.BLwould reference theMy.Project.Typesassembly and thus obtain theCartype from there. Note that I haven’t namespaced theCarclass into a namespace calledMy.Project.Typesbecause that namespace would be spurious and somewhat pointless, instead I’ve left them inMy.Projectwhich makes much more sense.