Here in this article, I would like to cover the typical three layer architecture in C# .NET which is very useful approach for coding. It makes application more understandable, easy to maintain, easy to modify and help to maintain good look of architecture.
First let me give you a small overview about the topic I would like to cover in this article.
· Three Tier/Layer Architecture Design Components
· Demo: Three Layer Windows Application in C#.NET
3-Tier architecture contains 3 layers:
1. Application Layer or Presentation Layer
2. Business Access Layer (BAL) or Business Logic Layer (BLL)
3. Data Access Layer (DAL)
1. Application Layer or Presentation Layer :
Presentation layer is the layer in which the users interact with an application. This layer contains UI part of our application i.e., our aspx pages or input is taken from the user. This layer mainly used for design purpose and get or set the data back and forth.
2. Business Access Layer(BAL) or Business Logic Layer(BLL) :
Business layer is mainly working as the bridge between Data layer and Presentation layer. All the Data passes through the Business layer before passing to the presentation layer This layer contains our business logic, calculations related with the data like insert data, retrieve data and validating the data.
3. Data Access Layer(DAL):
Data layer contents Database Tables, XML Files and other means of storing Application Data. If we separate each layer by its functionality, then we come to know the below conclusion:
Picture of my presentation layer is given below:
We know that this layer contain all type of logic, , calculations related with the data like insert data, retrieve data and validating the data.
Hare I created an object named objGatewayStudent for class GatewayStudent which is situated in DAL. Here I created a function to save the student information. With this function a link is built with the DAL by calling objGatewayStudent.Save(aStudent).Here some other logic also shown. This logic show the saving status (saved or failed).
DAL: All type of data connection goes here .
In this project different classes are located in different folder according to their work. Here different folder are created for defining job of different layer. This picture shows different layer of my project.