locked
n-tier arch RRS feed

  • Question

  • User450403478 posted

    hi i am new to n-tier arch

    i want to implemnet the n-tier in the website development using asp.net with vb,is there any site from where i can learn the n-tier arch strictly in vb,

    my next question is if i had already developed the website then how can i implement the n-tier in it

    its very urgent waiting for ur reply

    i need step by step procedure in vb

    Saturday, April 17, 2010 9:53 AM

Answers

  • User-1659704165 posted

    Hi,

    In short n-tier System is :-

    Create class Project exaMPLE UI,BLL,Httprequest,database etc..

    and Add refence to your project and use it

    http://www.15seconds.com/issue/011023.htm


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 17, 2010 10:51 AM
  • User-1267218547 posted

    Hi imranwahabit ,

    For VB.NET n-tier example. please check the following links.

    http://www.15seconds.com/issue/051117.htm (VS 2005)
    http://www.15seconds.com/issue/051123.htm

    http://dotnetslackers.com/articles/aspnet/3-Tier-Architecture-Examples.aspx

    Or you can do the project by the following steps:

    Getting Started
    Make sure that your table is in Place and and it has a Primary key. because if you are using an Adapter, you cannot not update a table that has no Primary key, you will only select.

    Step1(Adding PL and BLL)
    In the First Step we are going create a Solution. you can call it anything meaningfull,

    Step 2(Adding PL and BLL)

    Step 3(Adding DAL to a Solution)
    In this Step, we are going to Add our DAL in the same Solution.

    Step 4(Adding DAL Componets)
    In this Step we are going to Add an Adapter.

    Step 5(Presentation Layer)
    Now in this Step we have to do small Adjustments. first add a datagrid into your Form and name it dgproperties and add four buttons like this.

    Step 6(Function in DAL)
    Lets go back again to our DAL Project. we are going to give our data to BLL from DAL and BLL will give the data to the Frontend(PL)

    Step 7(Calling DAL Functions in BLL)
    Now we are going to call DAL Function when Data is Requested from Business Logic layer from the Presentation Layer .

    Step 8(Call BLL functions from a PL)

    http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

    I hope it is helpful to you. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 21, 2010 10:26 PM

All replies

  • User-1659704165 posted

    Hi,

    In short n-tier System is :-

    Create class Project exaMPLE UI,BLL,Httprequest,database etc..

    and Add refence to your project and use it

    http://www.15seconds.com/issue/011023.htm


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 17, 2010 10:51 AM
  • User450403478 posted

    hi avinash its an good article but,i would like to know how to implement it in the website development is there any example so that i can get an clear idea 

    Sunday, April 18, 2010 3:05 AM
  • User-1267218547 posted

    Hi imranwahabit ,

    For VB.NET n-tier example. please check the following links.

    http://www.15seconds.com/issue/051117.htm (VS 2005)
    http://www.15seconds.com/issue/051123.htm

    http://dotnetslackers.com/articles/aspnet/3-Tier-Architecture-Examples.aspx

    Or you can do the project by the following steps:

    Getting Started
    Make sure that your table is in Place and and it has a Primary key. because if you are using an Adapter, you cannot not update a table that has no Primary key, you will only select.

    Step1(Adding PL and BLL)
    In the First Step we are going create a Solution. you can call it anything meaningfull,

    Step 2(Adding PL and BLL)

    Step 3(Adding DAL to a Solution)
    In this Step, we are going to Add our DAL in the same Solution.

    Step 4(Adding DAL Componets)
    In this Step we are going to Add an Adapter.

    Step 5(Presentation Layer)
    Now in this Step we have to do small Adjustments. first add a datagrid into your Form and name it dgproperties and add four buttons like this.

    Step 6(Function in DAL)
    Lets go back again to our DAL Project. we are going to give our data to BLL from DAL and BLL will give the data to the Frontend(PL)

    Step 7(Calling DAL Functions in BLL)
    Now we are going to call DAL Function when Data is Requested from Business Logic layer from the Presentation Layer .

    Step 8(Call BLL functions from a PL)

    http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

    I hope it is helpful to you. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 21, 2010 10:26 PM
  • User803211825 posted

    I hope you find this to be a fun post and possibly we get some discussion.

    "How do I write an n-tier?"

    Imagine that you asked "how do I drive a car" and someone brought out a beautiful red sports car and for 12 minutes of their 15 minute talk they tried to teach you the engine and the transmission.  I'm the guy who's going to tell you "put your hands on the wheel, turn it, push on the gas, and more importantly, know how to push on the brake."

    For me, n-tier was about making the presentation (PAL) and data access layers (DAL) as simple as possible and trying to put as much of the work into the business logic layers (BLL).

    Everything in BLL And DAL went into classes (in the App_Code folder). 

    The Presentation Layer was contained in the  aspx and aspx.cs or aspx.vb pages.

    Let's make a really simple example, a hello world type project, only we have a database table with two columns, one for the greeting and one for language of the greeting.  It has ten records ("Hello", "English"; "Hola", "Spanish";  etc.)

    The presentation layer contains one line of code to write the title and  a div element that will take string content from the code behind page.  That's all there is on the frong page.  The code behind page asks the BLL class to provide the string content to the div element. That's all there is on the code behind page.  We are done with the PAL.

    What next: we will have the BLL construct the string and we will have the BLL ask the DAL to give it a generic list containing the data from the table in the database.

    The BLL class builds the string content and you probably use a StringBuilder for this process.

    We have a custom class that can hold both the greeting and the language.  The BLL will be expecting a generic string holding objects of the type of this custom class.

    The DAL only needs whatever code is necessary to loop through the table and build a generic list using the type of our custom class.

    I hope this example drives home the point of making the outer layers, PAL and DAL as simple as possible. Devil's advocate: it took extra work to do this separation -- how can we justify the extra work?

    Two weeks from now you are told that your database will be replaced with a new one (sorry).  All you have to do is figure out how to build a generic list using the new data base and then you can replace the DAL and you are finished.  Contrast that with your friend who has to go through all the files on the web site looking for any code that talks to the database (you only had to look through the files in your DAL folder.)

    You get extra points every time a different BLL can make use of your simple DAL page.

    You get even more points when different presentation layers (something1.aspx, something2.aspx) can make use of the large string that you built in the BLL.

    If we were discussing this in person we might come up with a reasons to be thankful that the presentation layer was simplified (when we *deported* code to the BLL classes).  I'll tell you though, most of my appreciation so far has come from the simplifications on the DAL side.  Thanks to CSS, the benefit of "separation" has been available to you without 3 Layer.

    Finally the work of separation took presentationcontent away from business logic code and it took data access content away from business logic code -- result: business logic code is easier to read.  When you are given more business logic rules (see Murphy's Law) the work will be easier (didn't say easy, lol).

    You asked about converting a non-3-Layer to a 3-Layer.  I would see this as starting with creating your BLL folder or folders and start building classes to take content from presentation layer and data access layers.  I'm assuming that you have pages that mix PAL and BLL and pages that mix DAL and BLL.  By moving the BLL you reach a point where the BLL is all gone and you have pure PAL or DAL pages. 

    Are you under a mandate to go pure 3 Layer, or have you decided on your own that you want the benefits from 3 Layer and you want to upgrade as time permits? 

    I found it convenient to write BLL And DAL into the names of files so I could see which files belonged where (and if I found myself needing to call something with DAL in the name from a presentation layer page, I knew I was noncompliant.)

    Let me know if you want to discuss this.  I hope we can learn from each other.

    (also, no criticism is meant for the tutorials we have which teach us 3 layer design--as to their authors, there are quite a few of them with whom I'd like to meet some day to say thank you.)

    -Danny



    Friday, April 23, 2010 2:35 PM
  • User-952121411 posted

    Here are a few more links that may help you:

    Building an N-Tier Application in .NET: 

    http://msdn.microsoft.com/en-us/library/ms973279.aspx

    3-tier Architecture with ASP.NET 2.0: (select language)

    http://msdn.microsoft.com/en-us/library/aa581769.aspx

    Application Design Guidelines: From N-Tier to .NET:

    http://msdn.microsoft.com/en-us/library/ms978384.aspx

    Friday, April 23, 2010 4:12 PM