I am building a 3 tier architecture with a Presentation Layer (PL), Business Logic Layer (BLL) and a Data Access Layer (DAL).
Conventional 3 tier architecture logic states that BLL should act as a mediator between the PL and the DAL. The PL shouldn't be even aware that there is a Database while the DAL should not be aware that there is a BLL or a PL.
Implementing above would create following dependencies among the 3 different physical projects as follows
- PL Project -> Reference of BLL DLL
- BLL Project -> Reference of DAL DLL
- DAL Project -> No Reference
However applying the concept of IOC between the BLL and the DAL by defining interfaces in the BLL for the DAL to implement and using DI via constructor injection will change the dependency as follows
- PL Project -> Reference of BLL DLL, Reference of DAL DLL (for DI of concrete types to constructors of the BLL Objects)
- BLL Project -> No Reference
- DAL Project -> Reference of BLL DLL (for implementation of BLL Interfaces)
So are IOC and traditional 3 tier in conflict ?
Ideally I want to achieve the following, while maintaining my IOC with DI.
- PL Project -> Reference of BLL DLL
- BLL Project -> No Reference
- DAL Project -> Reference of BLL DLL
How do you do this ?