Introduction:

3-Tier architecture is a very well know buzz word in the world of software development whether it web based or desktop based. In this article I am going to show how to design a web application based on 3-tier architecture.

3-Tier architecture generally contains UI or Presentation Layer, Business Access Layer (BAL) or Business Logic Layer and Data Access Layer (DAL) and sometimes property layer.

Presentation Layer (UI)

Presentation layer contains pages like .aspx or windows form where data is presented to the user or input is taken from the user.

Business Access Layer (BAL) or Business Logic Layer

BAL contains business logic, validations or calculations related with the data, if needed. I will call it Business Access Layer in my demo.

Data Access Layer (DAL)
 
DAL contains methods that helps business layer to connect the data and perform required action, might be returning data or manipulating data (insert, update, delete etc). For this demo application, I have taken a very simple example. I am assuming that I have to play with record of persons (First Name, Last Name, and Age) and I will refer only these data throughout this article.

Property layer.

Generally it contains the entire variable those need to pass from presentation to bal, bal to dal and vice versa so instead of writing those each and every time we can create property layer.

Typical structure will look like this.

It contains one solution with three class library and one website.

layer.gif

Now to create above structure first create new project and add one visual studio blank solution.

Now add 3 class libraries and one website in it give the relative name to them.

For the code purpose or what to write in which layer please download the source code.
 

Next Recommended Readings