• Notice regarding image hosts and attachments. See here.

N-Tier

Soldato
Joined
14 Feb 2004
Posts
14,316
Location
Peoples Republic of Histonia, Cambridge
Can anyone suggest a good example of an N-Tier architecture (preferably written in C#) that they've actually/partially used in a really world application. I'm really struggling for some best practise guide lines, and all the examples I found so far are less that comprehensive.

I'm looking for something a little more in-depth that the usual one database table and associated BLL/DAL class containing the four CRUD methods and nothing much else. Ideally the example will use multiple classes/tables demonstrating how to approach complex relationships. I'm also looking for something that doesn’t use typed datasets/table adapters for its data access.

Books or links welcome :)
 
Last edited:
Take a look at LINQ - that can generate the DAL for you and is pretty powerful.

I did some research on it however and it wasn't to my liking (I'd prefer to write the SQL myself and use typed datasets/table adapters).
 
Try looking at some ORMappers. One I have used for personal projects is Wilson ORMapper:
http://code.google.com/p/wilsonormapper/
Another more complicated one is netTiers:
http://nettiers.com/

It will generated the middle-tier for you from the DB, which you can obviously extend yourself further.
I've not seen ether of these. Thanks.
nHibernate is also worth a look.
I've had a play around with nHibernate in the past. What are your impressions of it, what sort of projects have you used it for?

Tbh most of the developers at my company are very suspicious of ORM and code generation tools generally. How flexible are the tools mentions, how easy are they to customise, are there any long term pitfalls? Also do the ones mentioned above generate separate data access and entity class layers?
Take a look at LINQ - that can generate the DAL for you and is pretty powerful.

I did some research on it however and it wasn't to my liking (I'd prefer to write the SQL myself and use typed datasets/table adapters).
I'm staying well clear of linq for the same reasons I keep well clear of the Microsoft provided DataSet/Table Adapters model. They break just about every programming guideline in the book and don't fit well with object oriented architecture.
Couple of books worth checking out:

Patterns of Enterprise Application Architecture by Martin Fowler is definitely worth picking up.

Expert C# 2005 Business Objects, Second Edition by Rockford Lhotka (not sure if there's a 2008 edition yet)
I've not read the first one, but we have a copy of the second book knocking round the office. It centres heavily on CSLA architecture which we've had a bad experience with in the past. I'm not sure if it's just our implementation or a problem with CLSA as a whole, but it seems very cumbersome to work with, and has some serious performance issues when dealing with large volumes of data.

We are currently at a proof of concept stage and just toying around with a few ideas, trying to find something that easy to use but also scale well. It’s more of a back to basics that will hopefully pay dividends in the long term.
 
Last edited:
I've not read the first one, but we have a copy of the second book knocking round the office. It centres heavily on CSLA architecture which we've had a bad experience with in the past. I'm not sure if it's just our implementation or a problem with CLSA as a whole, but it seems very cumbersome to work with, and has some serious performance issues when dealing with large volumes of data.

I didn't buy into CSLA fully - I just nicked the bits that seemed to work well.

We are currently at a proof of concept stage and just toying arround with a few ideas, trying to find something that easy to use but also scales well. It more of a back to basics expersise that will hopefully

Definitely a good time to pick up a copy of that Fowler book - it'll give you plenty of ideas.
 
I keep well clear of the Microsoft provided DataSet/Table Adapters model. They break just about every programming guideline in the book and don't fit well with object oriented architecture.

What makes you say that, out of curiosity? I've not had any problems incorporating them into any project I've ever done, and they certainly beat any manually written data access code I've come across.
 
i'm a fan of the repository factories, builds all the DAL, and OL for you, just point at a database and away you go.. does all the boring stuff! ie hand writing the Data access ........yawn.......

all of the data is dealt with in generic lists, whihc i find a lot more friendly than unwieldey datasets and datatables.

http://www.codeplex.com/RepositoryFactory

only downside, only works in VS 2005.
 
For a recent project we implemented the repository pattern using castle projects nHibernate facility. Not only do we have ORM but we can also use nHibernates undelying ado to create your own custom data objects. nHibernate is a proven ORM tool and both MSSQL and Oracle compatible which helps if you have some akward clients on Oracle. Castle facility makes accessing nHibernate a breeze.
I'd say do a bit of research into nhibernate, there should be some example floating around on the net. Initially we were looking into subsonic and nettiers which also seems quite popular.
Good luck.
 
Last edited:
Back
Top Bottom