locked
3 tier architecture RRS feed

  • Question

  • Hi all

    i have read an artical about making  3 tier architecture apllication using Typed data set ,but what i want
    to learn is how to build a custom 3 tier architecture for a DB application.
    (building it from scratch with my own dataAccess layer classes,bussinessLogic Layer Classes and the  presentation Layer)

    Can any one help me to find a resource to perform this ,or explain to me how to do it,and what is the best way to do this

    Best regards
    Matelin
    Thursday, August 9, 2007 11:12 AM

Answers

All replies

  • There is no "best way" to do this. When it comes to architecture -considering different quality attributes (e.g. emphsis on scalability  vs. emphasis on consistency ) will produce different architectures.

    Generally speaking , while  I would generally not recommend using Typed Data Sets, I would probably not recommend building your own data access layer either (unless you have very specific data access needs). You can look at several data access solutions available like iBATIS or nHibernate

    Arnon
    Sunday, August 12, 2007 9:27 AM
  • Hi
    Thanx for replying

    i trying to read some document and artical in 
    iBATIS and  nHibernate
    and i will feed u back later

    Best regards
    Matelin

    Tuesday, August 14, 2007 6:44 AM
  • Hi,

     

    nHibernate is a ORM tool used to map database objects/tables into data access classes an entities. This is fine but bear in mind that it is not a general fit for everything. There are many situations and reasons why you may still want to write your own dataaccess code. For example, to have complete control over what sql is used etc...since most ORM tools often generates its own which may not always be scalable (although you can often customise it using the tool).

     

    It is also beneficial to learn how to go about writing your own nTier app including custom dataaccess so that you become familiar with the issues and ways in which applications should be architected so that you better understand the way in which tools such as nHibernate can assist you, but are not blind to the internals of what its doing and take it as gospel that its implemented in the best way.

     

    Another way, which is something we do, is do write your own datacess and entity classes and then feed a template into a product like codesmith which can be pointed to tables in a db to build the classes automatically for you as a starting point, from which you can add the classes into your project and tweak them further.

     

    Tuesday, August 14, 2007 12:30 PM
  • Hi

    I tried to find any resource that can help me to build my own classes (simple nTier application) but i could not find any thing what i find (Typed Data Set to Make Data access Layer,and ORM Tools).

    Alot of ORM Tools is an (open source) but very very hard to start with unless i want only to use it as dummy

    Best Regards
    Matelin


    Tuesday, August 14, 2007 1:45 PM
  • Hi,

    Well if you want an example you can look at the Duwamish sample. Although it perhaps hasn't been updated of late it is still a good Microsoft .NET example of implementing an n-tier architecture. If you go through the solution carefully which is made up of a few projects that implement the various tiers, you'll get a good idea of how you can use it as an example to go about writing your own n-Tier applications. Note: The presentation layer is done in ASP.NET.

    Duwamish Sample download (C# or VB.NET):
    http://msdn2.microsoft.com/en-us/library/ms978471.aspx

    Duwamish Overview and related links:
    http://msdn2.microsoft.com/en-us/library/aa288561(VS.71).aspx

    And for some good background reading you can look at:

    - Application Architecture for .NET: Designing Applications and Services http://msdn2.microsoft.com/en-us/library/ms954595.aspx

    - Designing Data Tier Components and Passing Data Through Tiers
    http://msdn2.microsoft.com/en-us/library/ms978496.aspx



    Again, some of the above reading was written a while ago and for .NET framework 1.1 but it is still as relevant today as it as then. And if you still want to learn more about implementing nHibrnate in ASP.NET, then check out http://www.codegod.de/WebAppCodeGod/nhibernate-tutorial-1---and-aspnet-AID25.aspx


    I hope the above helps.
    Good luck !    Wink


    Tuesday, August 14, 2007 6:55 PM
  • Duwamish is not updated because it is obsolete as a 3 teir architecture however the Enterprise Library 2.0 comes with CSLA for the object layer.  And there is a very good three part tutorial from Microsoft Europe.


    http://www.microsoft.com/belux/msdn/nl/community/columns/hyatt/ntier1.mspx

     

    http://www.microsoft.com/belux/msdn/nl/community/columns/hyatt/ntier2.mspx

     

    http://www.microsoft.com/belux/msdn/nl/community/columns/hyatt/ntier3.mspx

     

     

    Tuesday, August 14, 2007 7:27 PM
  • I've taken a look at your above links. It has some good examples and I like the way in which they have split the articles into the different tiers. However it may be a newer example but I wouldn't say all aspects are shown are the best way of doing things. For example using typed datasets is often not preferred in many production and large scale apps. Yes you do get the benefits of a strongly typed dataset class, but at increased overhead and unecessary complexity of having to create a matching typed dataset for each table and the loss of performance when using the dataAdapter to fill it. Often using a datareader to load your custom objects is sufficient and better performing, also using an IList for the collection can be improved by simply using a List<> generic,etc..

    I still maintain that Duwamish is a good working example of a larger scale production type application. But it should be looked at in conjunction with other literature on the subject and some newer techniques as presented in the articles you mentioned above, including as you rightly said using the Enterprise Library 2.0. As well as using newer things like generics and objectDatasources,etc...


    Wednesday, August 15, 2007 7:49 AM
  • (I still maintain that Duwamish is a good working example of a larger scale production type application.)


    Duwamish is obsolete because it was moved from VS6 to VS2003 without clean objects, I left a C# study group back in 2003 because Duwamish was chosen as the study topic for the group.  Woodgrove is a better choice because it is from the same period as Duwamish but it was updated to Asp.net 2.0 and then Microsoft moved it to what is now MOSS 2007.  I agree DataReader is better in most cases than Dataset but I covered that with the Enterprise Library 2.0 which I used this year.  And BTW Petshop 4.0 was released last year it was originally a Java application so it is all object.


    http://msdn2.microsoft.com/en-us/library/aa479070.aspx

    http://martinfowler.com/eaaCatalog/

     

    Wednesday, August 15, 2007 4:51 PM
  • Tuesday, December 27, 2011 10:39 AM