tags:

views:

199

answers:

1
+1  A: 

There is nothing overly complex about that diagram, so I'm going to assume that you are new to NHibernate. In that case, I recommend reading the Quick Start Guide and any of the tutorials here.

The basic process is to create .NET classes which represent your database tables and create mapping files so that NHibernate knows about them. NHibernate will take care of creating the connection between your classes and the database so that you can run HQL queries to retrieve objects. Modify/Create objects in your code and then persist the changes to the database with ISession.Save(). The thing to remember is that (in general) you are not doing the CRUD operations, NHibernate is.

  • CREATE: new MyObject(); followed by session.Save()
  • UPDATE: MyObject.change(); followed by session.Save()
  • DELETE: session.Delete(MyObject);
Stuart Childs
Another place for great NHibernate help: http://www.summerofnhibernate.com
joshua.ewer
Yeah, that one is the tutorials list but should probably be high up in that list instead of at the bottom. It's a good resource.
Stuart Childs
CorrectionUPDATE: MyObject.change(); followed by session.Update() or session.SaveOrUpdate()
Stefan Steinegger
Actually, it doesn't matter. Internally NHibernate converts all Save(), Update() and SaveOrUpdate() calls to firing the OnSaveOrUpdate event on a ISaveOrUpdateEventListener. These functions merely tell NHibernate to persist the object, it handles the rest. IOW, it's personal preference. :)
Stuart Childs