For the beginners its an astonishing phrase "3 tier architecture". For me it was same as yours now. But when I get that it seems the easiest thing in .NET. Its all about creating instances for classes and using those instances call the methods present in the class.
Three important layer of this architecture are
You may say why should I adopt architecture like this. we can direct pass it to database. As result I will say only one thing...
For the projects like school or college level its not so good. But for the huge projects in professional level or industry level it helps us to keep track the data flow in the application and in one vital thing, the code re-useability.
So the pictorial description will be something like this.
Start a new project and add a new web page named Default.aspx.
Add a text box and a button on Default.aspx page. Now add a BLL folder and DAL folder in the project.
Three important layer of this architecture are
- Client Layer (class file of aspx page)
- Business Logic Layer(BLL) (normal class file)
- Data Access Layer(DAL) (normal class file)
You may say why should I adopt architecture like this. we can direct pass it to database. As result I will say only one thing...
For the projects like school or college level its not so good. But for the huge projects in professional level or industry level it helps us to keep track the data flow in the application and in one vital thing, the code re-useability.
So the pictorial description will be something like this.
Start a new project and add a new web page named Default.aspx.
Add a text box and a button on Default.aspx page. Now add a BLL folder and DAL folder in the project.
Now add a data_bll.cs and data_dal.cs file in BLL and DAL folder respectively. And add methods named getData_bll(string data) and getData_dal(string data) in both respectively.
In Default.aspx.cs page add a namespace of BLL
Using ProjectName.BLL;
and in the button click event create an instance of data_bll class. Don't forget to make a public constructor in both classes.
data_bll obj = new data_bll();
now call the getData_bll(string data) using that obj.
obj.getData_bll(txtBox.Text.Trim());
so in data_bll.cs class we are getting the data and pass it to data_dal class just like we did previously.
add a namespace first of DAL.
Using ProjectName.DAL;
now create instance and call method with argument.
data_dal obj = new data_dal();
obj.getData_dal(data);
Now in data_dal.cs class send this data to database using store procedure or write any sql command to execute. All the database functionalists will handle from this class file or from this folder.
For the data flow is here once again for you.
So enjoy your 3 tier architecture. Don't forget to comment.
Download the code here.
In Default.aspx.cs page add a namespace of BLL
Using ProjectName.BLL;
and in the button click event create an instance of data_bll class. Don't forget to make a public constructor in both classes.
data_bll obj = new data_bll();
now call the getData_bll(string data) using that obj.
obj.getData_bll(txtBox.Text.Trim());
so in data_bll.cs class we are getting the data and pass it to data_dal class just like we did previously.
add a namespace first of DAL.
Using ProjectName.DAL;
now create instance and call method with argument.
data_dal obj = new data_dal();
obj.getData_dal(data);
Now in data_dal.cs class send this data to database using store procedure or write any sql command to execute. All the database functionalists will handle from this class file or from this folder.
For the data flow is here once again for you.
So enjoy your 3 tier architecture. Don't forget to comment.
Download the code here.
.Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai and i use your guide to educate my students.
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery