The Freak Parade

Strange noises from the mind of Nathan Stults…
  • rss
  • Home
  • About The Freak Parade

So you want to learn NHibernate? (or, NHibernate Hyperlink Acupuncture)

July 31, 2008

image NHibernate is a rich and robust open source Object Relational Mapping (ORM) tool. See my preambles to this post for a brief overview of NHibernate and some architectural prerequisites.

NHibernate is currently in version 2.0, which is being billed as a complete (or mostly complete) port of Hibernate version 3.2. That means that in addition to these resources, books and materials relating to Hibernate 3.2 should also apply in large part to NHibernate 2.0.

The Official Documentation & Project Resources

NHForge
Strange name, but promising new NHibernate community website. It is a little lightly populated at the very moment, but this looks like it will be a one stop shop for downloading NHibernate core libraries and the many satellite projects, documentation, etc.

NHibernate Wiki
This is a new resource that was made available along with the release version of NHibernate. I believe the formal NHibernate 2.0 docs live there now.

NHibernate Deep Grok
This funkily-named resource is an app-engine / google-custom-search powered search engine focused entirely on NHibernate. If you need to do an Internet search for NHibernate related material, this is a very good place to start.

NHibernate 1.2 Documentation
A complete reference for NHibernate 1.2, the precursor to 2.0 and the latest official release.

NHibernate Users Forum & E-Mail Discussion List
A Google group / mailing list for asking and responding to NHibernate questions. Invaluable resource. If you haven’t participated in an e-mail list (which is like an e-mail based discussion forum) you should try it, you learn a lot and it is fun.

Source Code On SourceForge
This is the SourceForge home page where you can download the latest releases or, if you have the constitution for it, check out the latest version from the trunk.

The Project Home Page
The official home of the project at hibernate.org.

NH Contrib Project Project Page
The contrib project has some nice components that aren’t part of the core, but are hugely useful anyway. These include LINQ to NHibernate, a validation framework, a session context framework (Burrow) and other good things.

Getting Started

The REAL starting place is here. But if you’ve digested those materials and are ready to start writing some code, check out these resources:

Learn How to use NHibernate with the Summer of NHibernate Screencast
This is a post by Scott Hanselman pointing to the Summer of NHibernate Screencast series. I linked to this post instead of directly to the screencast page because Scott compiles some other learning materials in the post, and provides commentary.

Your first NHibernate based application
Setting up NHibernate 2.0
Using NHibernate as an ORM Solution for .NET

Crucial Community Resources

NHibernate FAQ
This is an NHibernate blog, and a fantastic one at that. A good portion of the links on this page are from that blog - if you are going to develop with NHibernate, you will want to not only subscribe to this blog but take the time to read the archives.

Ayende’s NHibernate Category
This is just a link to the RSS feed for the NHibernate category on Ayende Rahien’s blog (a contributor to NH). Lots of great stuff here.

NHibernate Resharper Plugin
If you use Resharper, this plugin will validate your NHibernate xml mappings.

 

Best Practices & Reference Applications

NHibernate Best Practices with ASP.NET, 1.2nd Ed. - Billy McCafferty
This is a code project article about using NHibernate and a reference app using DDD and an ASP.NET MVP pattern.

S#arp Architecture
This is a CodePlex project providing a reference app and an article included as documentation that provides a reference architecture for using ASP.NET MVC, NHibernate and Castle Windsor. A discussion list for this forum is here.

Foundations of Programming Learning Application
This is an application designed to be a reference app for doing DDD. This also uses ASP.NET MVC and NHibernate.

Code Store Reference App
Another reference app utilizing NHibernate. Also uses Castle Windsor and Tree Surgeon.

How to review a NHibernate application
Ayende’s list of best practices when designing a system using NHibernate.

 

NHibernate 2.0 Announcements & New Features

NHibernate 2.0 Alpha is out!
NHibernate 2.0 Announcement from InfoQ

Rhino Commons

Rhino Commons is part of Rhino Tools, and must be downloaded from the trunk of that project. Rhino Commons is several things ("just a utility library" isn’t one of them) which you can discover for yourself, but one of the things it is is a dash of infrastructure that really smoothes out the wrinkles when working with NHibernate. I can’t tell you how many posts are on the web relating to setting up a UnitOfWork object and managing sessions, or implementing a generic Repository to abstract working with NHibernate sessions. Rhino Commons provides very usable implementations of these concepts. Rhino Tools, by the way, contains a few sample/reference apps for using Rhino Commons as well as NHibernate. Check out Hibernating Forums, for example. Most of these links are about using Rhino Commons with an ASP.NET MVC app. Not sure why that is, but it works for me.

Beginning System.Web.MVC with Rhino Tools, Castle Active Record and Nhibernate, Pt 2, Pt3
RhinoCommons, NHibernate and ASP.NET MVC Part 1, Pt2, Pt3, Pt4, Pt5
NHibernate and the Unit of Work Pattern <–Not strictly about Rhino Commons, but explains the concepts behind it
Adaptive Domain Models with Rhino Commons
AOP With Windsor: Adding Caching to IRepository based on T’s attributes 

Note: In the NHibernate Contrib project is a tool called NHibernate Burrow - it feels to me like the intention of this project and the intention of the session management in Rhino Commons may be the same - but I haven’t dug any further than that. Anyone wish to clarify in the comments?

Misc. Concepts

 

Implementing Frictionless Soft Deletes in NHibernate

Soft Delete in NH

Mapping & Collections

Testing Mappings & Fluid Interface for Mapping 
The above link explores a mechanism to do NHibernate mappings in code instead of XML, giving you all kinds of benefits.

image

[UPDATE] Apparently a full blown open source project has been established to build a fluent interface for doing NHibernate mappings, which is exciting. The project source code repository is here, the Google group / users form is here and a blog post introducing the library and providing a quick start is here.

Mapping Collections in NHibernate (Part 1)
Custom Collections with NHibernate, Part I: Who Cares?
Custom Collections with NHibernate, Part II: The Basics
Custom Collections with NHibernate, Part III: Refactored

Generating / Synchronizing the Database Schema from a NHibernate Model


Create and Update Database Schema

Querying & LINQ to NHibernate
Linq to NHibernate in 10 Minutes
Linq to NHibernate
Kyle Baley - Trying out Linq to NHibernate
My NHibernate 2.0 Supa’ Layer (something new from Rob Eisenberg)

NHibernate Query Generator
[Update (see comments)] NHibernate Query Generator will create strongly typed queries when working with NHibernate using .NET 2.0. LINQ to NHibernate supercedes the NHibernate Query Generator, so if you are working in .NET 3.5, prefer to use LINQ for your strongly typed queries. For .NET 2.0 apps, however, NHibernate Query Generator is a strong alternative.

Lazy Loading & Eager Loading

Lazy Loading - Eager Loading
Eager loading aggregate with many child collections

Entity Joins & Relationships

When to use many-to-one(s) vs. many-to-many with NHibernate
Performing Join Queries with NHibernate CreateAlias

Misc

Audit Options with NH
Integrating Castle Windsor and NHibernate with WCF - Throwing the WCF facility and some Rhino Tools in the mix
Book review: NHibernate in Action
Using Entity-Assigned ID’s

Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • DZone
  • Digg
  • Google Bookmarks
  • Ma.gnolia
  • Technorati
hello
Categories
NHibernate, ORM, Rhino Tools
Comments rss
Comments rss
Trackback
Trackback

« So you want to learn NHibernate - Part 0.5, Prerequisites (or NHibernate = Marijuana.NET) StackOverflow.com - First Impressions »

discussion by DISQUS

Add New Comment

  • Subscribe:  This Thread
  • Go to:  My Comments ·  Community Page
  • Sort thread by:

    Viewing 5 Comments

    Thanks. Your comment is awaiting approval by a moderator.

    Do you already have an account? Log in and claim this comment.

      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Ayende Rahien 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      NHibernate Query Generator is a way to get some strongly typed queries in the .NET 2.0 world.
      Linq to NHibernate supersede that, and I plan to retire the project when Linq for NH reach 2.0 status.
      reply  edit  reblog  flag
      http://www.ayende.com/Blog/ /people/730a9f9186e14b8da5a4e453aca2adfe/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Ryan Lanciaux 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Nathan, this is a great resource you've put together here. When I get some time I may check out what the NHib Burrow is really doing, mainly out of sheer curiousity.
      reply  edit  reblog  flag
      http://www.frickinsweet.com/ryanlanciaux.com /people/398a1e4557ca51c3d61403be5e4d101d/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Nathan 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Ryan, that would be great. It does look interesting, but so does everything else :) Time is such an annoying limitation, I don't know why the universe bothers us with it.
      reply  edit  reblog  flag
      /people/0c3d87f16b8502cd2dcf6d54707344fa/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Chris Martin 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Kick ass IList! ;)
      reply  edit  reblog  flag
      /people/a12a0565d032994007450e9c7dea6976/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      cowgaR 3 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      this 3 part series has been an enormous research...something I like doing aswell

      great work
      reply  edit  reblog  flag
      /people/4661768134975d423174a7506badb1c7/
     
    discussion by DISQUS

    Add New Comment

    Trackbacks

    (Trackback URL)

    close ()

    status via twitter

    recent comments (follow comments)

      View Profile ยป
      Powered by Disqus · Learn more
      close Reblog this comment
      Powered by Disqus · Learn more
      blog comments powered by Disqus

      Subscribe

      Calendar

      July 2008
      M T W T F S S
      « Jun   Aug »
       123456
      78910111213
      14151617181920
      21222324252627
      28293031  

      Recent Posts

      • You Can’t Fill an Imaginary Hole
      • I don’t know but I’ve been told, ETL is gettin’ mighty old. BAM! BAM! EDA! I want my data right away!
      • Be Prepared To Be Surprised
      • Google Chrome, I could kiss you! (Or, multi-process browsers are a really good idea)
      • New Open Source .NET CMS/EPS Platform Released Today: Sense/Net 6.0 Beta 1

      Recent Comments

      • nstults on Content Management Systems (CMS) for the .NET Platform
      • Adz on Content Management Systems (CMS) for the .NET Platform
      • nstults on I don’t know but I’ve been told, ETL is gettin’ mighty old. BAM! BAM! EDA! I want my data right away!
      • Hamilton on I don’t know but I’ve been told, ETL is gettin’ mighty old. BAM! BAM! EDA! I want my data right away!
      • nstults on Flowing Identity from a Client to a Service when using RESTful WCF Part 2 - A Solution

      Tags

      TDD Testing

      Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
      rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox