
上QQ阅读APP看书,第一时间看更新
Two Tier Model
Here we create two projects, one normal web project for UI code, and another class library project for the BL and DAL code. This will ensure that even if we change the BL or DAL code, we don't need to recompile the web project as we have separate physical assemblies. This setup is more scalable and maintainable than all previous options. Separating code into different assemblies will involve a slight performance hit, but that is negligible considering the flexibility and maintainability benefits we get by having two tiers.
The solution will have:
- ASP.NET Web Project having GUI and presentation code (Tier 1)
- A class library project having business logic and data access coding under a single namespace,
MyApp.Code
; no separate namespaces for business logic and data access code (Tier 2)
In this case, we still have the BL and DAL code under one namespace, but we can logically separate them further, as shown below.