C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






3 Tier Architecture in .NET - Sample Application


Posted Date: 07 Jul 2008    Resource Type: Articles    Category: General
Author: Brainstorming GuyMember Level: Diamond    
Rating: Points: 15



3 Tier Architecture in .NET - Sample Application

In this article we are going to look on how to create a 3 tier architecture application in .NET.

Basically three tier architecture needs to 3 projects to be created.
1. UI Layer
a. All you UI related stuffs like pages, user controls, CSS and java scripts will go into this.
2. Business Layer
a. All business rules are performed here.
3. Data Access Layer
a.All data access code like connecting to database and getting the details are done here.
4. Apart from these three projects, we will be having one more project called as Model. This will have all model classes which we use it in out application

It’s not a good idea if you pass a dataset or data table from the DAL to the UI. We need to map those table fields to our custom class and we need to pass the custom object from the data access layer to UI. This is what we called ORM (Object Relational Mapping).

These things will come into picture like whenever, you want to expose your BAL through the Web Services, you can quite easily do that. And putting the model classes will make your code maintenance much easier. This will give the programmer to expand the current functionality of the classes when they are needed.

That’s where the model classes come to the picture. I have 2 model classes used for this demo.
1. Employee.cs
a. This is a base class. Whenever we need to pass and get the employee details, we will be using this class.
2. EmployeeCollection.cs
a. This class is inherited from Collection which will hold the collection of Employee objects.
When you want to get the detail of one employee, then you can make use of Employee class. When you need to get the collection of the empoyees, you can use the EmployeeCollection. I have inherited from Collection,so that I can make the class as a strongly typed collection object. Thought of implementing the IList for this, but I dropped that because Collection already implements the ILIst, ICollection and IEnumerable. That made my life easier in creating a sample application.

This application is developed using VS2005 and ASP.NET 2.0. Make sure you have Web Project Template installed in your machine else, you won’t be able to open this application.

I have attached the demo application of 3 tiers. You can just download it and how a look how exactly we can implement the 3 tier architecture in the projects.

This is basic for n-tier architecture need to think more when you design your project on how to implement the tiered architecture.

Please feel free to post your queries. I will always be happy to answer and respond to your query.

By,
Brainstorming Guy aka Venkatarajan A


Attachments

  • 3 Tier Architecture - Demo Project (19462-7751-ThreeTierArchitectureDemo.zip)



  • Responses

    Author: Sheo Narayan    17 Jul 2008Member Level: Gold   Points : 1
    See details step wise tutorials of 3-tier architecture http://dotnetfunda.com/articles/article71.aspx


    Author: Brainstorming Guy    18 Jul 2008Member Level: Diamond   Points : 2
    Hi Narayan,
    I don't see it as a tiered architecture. It looks like a layered one.
    As you know, there not much option provided here to attach some imaged with give link. ( or i may not be knowing how to do that).
    Anyway, thanks for it man. Will look into that.

    Regards,
    Brainstorming Guy aka Venkatarajan A


    Author: Sheo Narayan    18 Jul 2008Member Level: Gold   Points : 2
    Ah, I got your point. For the ease of understanding in that article, I have created BAL and DAL into App_Code folder. I have specified this in the article too.

    In real scenario, all 3-Tiers (BAL, DAL and UI) should have 3 separate projects.

    Thanks for pointing this out.

    Regards,
    Sheo Narayan


    Author: Brainstorming Guy    18 Jul 2008Member Level: Diamond   Points : 1
    Thanks Man.
    Anyway, article looks good.
    Thanks for providing it.

    Regards,
    Brainstorming Guy aka Venkatarajan A


    Author: Ashish Shah    19 Jul 2008Member Level: Gold   Points : 2
    Hello,

    Its not looks too good for articla in this level of site..

    I think there is much information and concept can add in this one..

    Very basic and little information with less explanation..
    Anyway still good work to write..!!

    Better luck next time ..

    With Regards..

    Ashish Shah
    India,Surat


    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Tier Architecture  .  Three tier architecture sample code  .  Three tier architecture  .  N Tier Architecture  .  3 Tier Architecture  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Design Pattern - Builder Pattern
    Previous Resource: SSL(Secure Socket Layer ) Certificate Info
    Return to Discussion Resource Index
    Post New Resource
    Category: General


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design


    Contact Us    Privacy Policy    Terms Of Use