views:

308

answers:

6

I'm trying to put together a presentation for my local .NET user group on NHibernate. I want to demonstrate how one might convert an existing application's data access layer to use NHibernate, but first I need an application to convert.

What would be a good example domain that would allow me to demonstrate the main features of the ORM? It needs to be easy enough for the listeners to understand, but include things like an inherited class or two to show how NHibernate handles that.

Current Ideas:

  • Blog -overused, no obvious inheritance relationships?
  • Auction Site - used in NHibernate in Action - would need to rewrite DAL to use stored procedures via ADO to demonstrate conversion
  • Online Store

Any ideas?

+1  A: 

I'd vote for an online store - different products with data, invoices, carts, users, addresses - I think you get the idea.

You can make it as big and as small as you wish. I think everyone understands it. Something like that was my first NHibernate project - and I think it was a good start.

bernhardrusch
+1  A: 

An idea that would could demonstrate some inheritance features would be any site/store that offers products that have varying "packages" and features associated with different versions. A great example would be an automotive site where you could list the details of various models of cars and the different features that they possess.

You would obviously have your base class of vehicles, but you could begin building upon that with the different vehicle types (car, truck, suv, etc.) and then further upon that (car->coupe, sedan, truck->half-cab, king-cab, etc.)

TheTXI
+2  A: 

You can look at this: http://code.google.com/p/ndddsample/ which is the Domain Driven Design Sample in c# and it uses NHibernate

eulerfx
+3  A: 

How about a company address book application? People have obvious properties and ContactLists are a collection of People. People have Addresses. Calling a ContactList is clearly not possible; however sending messages to a person and sending to a ContactList should have the same exposed API to an SmtpClient.

This example allows you to illustrate:

  • basic mapping (i.e. FirstName, etc)
  • composite mapping (pretend you wanted to represent First, Middle, Last, and Nickname columns in a Name class)
  • Has-One (or Many depending on your reqs) (i.e. Person -> Address)
  • Many-to-Many (i.e. ContactList <-> Person)
  • inheritance (using an abstract base class)
ddc0660
+3  A: 

Northwind would do just fine.

For ideas how to show conversion - i would recommend you to take a look into Sh#rpArchitecture
(they use Northwind as example).

Just don't forget that sample app is secondary - focus more on emphasizing key features of NHibernate.

Arnis L.
Seconded. I use Northwind for most tech demos because there's plenty of data, and the domain is a) sufficiently complex, b) reducable if you don't want the complexity, and c) easy for laypersons to understand.
Iain Galloway
Arnis L.
+1  A: 

I second @ddc0660, and here's a potential snippet of such a design via the 'Contact Point Pattern' from the book: "Building object applications that work".

Rabid