ASP.NET 3.5 Application Architecture and Design
上QQ阅读APP看书,第一时间看更新

Single Tier—Three Layer Model

In this model, we logically break BL and DAL in different namespaces, introducing cleaner code separation.

ASP.NET Web Project that has logical separation between presentation, business logic and data access code:

  • All presentation code will be under the MyApp.Web namespace (Layer 1).
  • Furthermore, the single project can have two folders:
    • Business (Layer 2): for business logic code, with namespace MyApp.Code.Business
    • DAL (Layer 3): for data access code, with namespace MyApp.Code.DAL

Note that it is not necessary to have different folders for the logical separation of code; using different namespaces in different code files will also work fine. We can use this model for a medium-to-large web application where we know that many users won't log in simultaneously. For handling a large number of users, the application needs to be scalable, and to do this we might need to separate BL and DAL code into their own physical assemblies.