Three Tier Architecture
Three Tier Architecture
Here
we can see that how these layers increase the reusability of codes.
These layers are described below.
1. Application layer or Business layer
2. Business layer
a. Property layer(Sub layer of business layer)
3. data layer
Business layer
This layer is a class which we use to write the function which works as a mediator to transfer the
data from Application or presentation layer data layer. In the three tier architecture we never let the
data access layer to interact with the presentation layer.
a. Property Layer
This layer is also a class where we declare the variable corresponding to the fields of the database
which can be required for the application and make the properties so that we can get or set the data
using these properties into the variables. These properties are public so that we can access its
values.
Summary
Application layer is the form where we design using the controls like textbox, labels,
command buttons etc.
Business layer is the class where we write the functions which get the data from the
application layer and passes through the data access layer.
Data layer is also the class which gets the data from the business layer and sends it to the
database or gets the data from the database and sends it to the business layer.
Property layer is the sub layer of the business layer in which we make the properties to sent
or get the values from the application layer. These properties help to sustain the value in a
object so that we can get these values till the object destroy.
// In ths following code we are calling a function from the business layer and
the property layer which will carry the ID till the
database.
ds=objbs.GetAllStudentBsIDWise(objproperty);
// What ever the data has been returned by the above function into the dataset is
being populate through the presentation laye.
txtId.Text=ds.Tables[0].Rows[0][0].ToString();
txtFname.Text=ds.Tables[0].Rows[0][1].ToString();
txtAddress.Text=ds.Tables[0].Rows[0][2].ToString();
txtemail.Text=ds.Tables[0].Rows[0][3].ToString();
Image1.ImageUrl=ds.Tables[0].Rows[0][4].ToString();
}
Property Layer
// These are the properties has been defined in the property layer. Using the object of the property
layer we can set or get the data to or from these properties.
public class clsStudent // Class for Student Table
{
private int _id;
private string _Name;
private string _Address;
private string _Email;
private string _Picture;
public int id // Property to set or get the value into _id variable
{
get{return _id;}
set{_id=value;}
}
public string Name
{
get{return _Name;}
set{_Name=value;}
}
public string Address
{
get{return _Address;}
set{_Address=value;}
}
corresponding operation
ds=objdt.ExecuteSql(sql);
return ds;
}
}