In Focus

NLayers Architecture

NLayers tries to provide a Layering solution to a typical ASP.NET application. This article is a continuation of the previous one about NLayers Introduction and Installation.

NLayers tries to provide a Layering solution to a typical ASP.NET application. This article is a continuation of the previous one about NLayers Introduction and Installation.

Intended Audience

This project framework is targeted for Architects or Developers with a good grip of ASP.NET and the Entity Framework.

Creating Solution

You can create a NLayers solution using the template as shown below. (You need to install the NLayers framework to see the following template.)

NLayer1.gif

(For installation of NLayers please refer to the previous article.)

Projects in NLayers

After creating a new project from the NLayers ASP.NET Application template you can see the Solution Explorer as shown below:

NLayer2.gif

Project

Description

NLayers.BusinessLogic

Business Logic part of the solution.  Least expected to be changing the implementation classes throughout the lifetime of project.

NLayers.DataAccess.Interface

Decoupled design for Data Access. 

NLayers.DataAccess.Implemenation

Implementation of Data Access Interface projet.

NLayers.Entity

Project containing the EDMX file of Entity Framework.   It contains the entity classes.

NLayers.InstanceManager

Project providing instance management for Business Logic and Data Access classes.

NLayers.Web

ASP.NET Web Application. This project uses the WebApp class of InstanceManager to access Business Logic and Data Access instances.

Control Flow

The start up project should be NLayers.Web. The Web project will be using the Instance Manager project to invoke Business Logic and Data Access classes.
The entity project will be used by all the projects.

The following diagram depicts the control flow.

NLayer3.gif

Layers in NLayers

The layers inside the NLayers Architecture are as the following:

  1. Web Application representing the Presentation Layer
  2. Business Logic representing the Business Logic Layer
  3. Data Access representing the Data Access Layer
    NLayer4.gif

NLayers Advantages

The following are the advantages of NLayers over a typical monolithic application:

  • Decoupled Design / Separation of Concerns
  • Easier Manageability
  • Better support for Unit Testing
  • Easier Replace of Data Access Implementation
  • Instance Management
  • CRUD wrappers over Entity Framework
  • VS 2010 Project and Item Templates for Quick Start
  • Better support for Dependency Injection / Policy Injection

Source

This article is meant to provide information on NLayers project. You can access the latest source or documentation from:

http://nlayers.codeplex.com/

Summary

This article explained the Architectural part of the NLayers framework. In the next article you will see examples of how to use NLayers.