Click here to Skip to main content
13,549,145 members
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 8 May 2012
Licenced CPOL

Introduction to NLayers

, 9 May 2012
Rate this:
Please Sign up or sign in to vote.
This article explains the installation and usage of the NLayers framework.


In this article I would like to introduce a layering framework named NLayers. This article is intended for experienced developers or architects with a good understanding of ASP.NET and the ADO.NET Entity Framework.


The framework can also be downloaded from CodePlex:

What is NLayers?

NLayers has the following:

  1. Visual Studio 2010 solution template for layered applications
  2. Contains Data Access wrapper class for CRUD operations

Following is the snapshot of a solution created using the NLayers template:


The core methods inside the DataAccess base class include the following:

  • Insert()
  • Update()
  • Delete()
  • GetAll()
  • Where()

The layered application framework can be used to create the following types of projects:

  • ASP.NET Web Application
  • WCF Service Application
  • Windows/WPF Application


Please download the latest setup file from the URL:


Use the Download button on the right side to get the NLayers.msi file.

Execute the MSI file, choose the installation folder, and click "Next" to complete the wizard. There will be a series of command lines executed for copying the templates and running the installation commands.


After the installation, open Visual Studio to view the NLayers installation.

Inside Visual Studio: Adding Solution

Inside Visual Studio, use File -> New Project to get the dialog box. You can see the NLayers ASP.NETApplication template from the NLayers group as shown below.


On creating the project template, we will see the Solution Explorer as given below.


Please make NLayers1.Web as the startup project if it is not.

Inside Visual Studio: Adding Items

For adding items, use the Add Item dialog from the respective project.


For example

NLayers Business Logic class should be added to the NLayers.BusinessLogic project. NLayers Data Access class should be added to the NLayers.DataAccess.Implementation project. NLayers Data Access Interface should be added to the NLayers.DataAccess.Interface project.


Apart from this article, you can get the official documentation of NLayers from:


Using NLayers

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

Projects in NLayers

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

Project Description


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


Decoupled design for Data Access.


Implementation of Data Access Interface project.


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


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


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

Control Flow

The startup project should be NLayers.Web. The web project will use the Instance Manager project to invoke Business Logic and Data Access classes. The entity project will be used by all projects. The following diagram depicts the control flow:

Layers in NLayers

The layers inside the NLayers architecture are as follows:

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

NLayers Advantages

Following are the advantages of NLayers over a typical monolithic application:

  • Decoupled design  / Separation of concerns
  • Easier manageability
  • Better support for Unit Testing
  • Easier replacement 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


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


This article explains the installation and usage of the NLayers framework.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jean Paul V.A
United States United States
Jean Paul is a Microsoft MVP and Architect with 12+ years of experience. He is very much passionate in programming and his core skills are SharePoint, ASP.NET & C#.

In the academic side he do hold a BS in Computer Science & MBA. In the certification side he holds MCPD & MCTS spanning from .Net Fundamentals to SQL Server.

Most of the free time he will be doing technical activities like researching solutions, writing articles, resolving forum problems etc. He believes quality & satisfaction goes hand in hand.

You can find some of his work over here. He blogs at

You may also be interested in...

Comments and Discussions

QuestionInteresting, but... Pin
Dewey9-May-12 12:38
memberDewey9-May-12 12:38 
AnswerRe: Interesting, but... Pin
FernandoUY5-Jul-12 8:19
memberFernandoUY5-Jul-12 8:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02-2016 | 2.8.180515.1 | Last Updated 9 May 2012
Article Copyright 2012 by Jean Paul V.A
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid