InfoQ

News

Learn NHibernate with The Summer of NHibernate

Posted by Robert Bazinet on Jul 31, 2008

Community
.NET
Topics
Training / Certification
Tags
ORM ,
nHibernate ,
ALT.NET

NHibernate has grown in popularity lately with more wide-spread use because of ALT.NET and competing technologies such as the Microsoft Entity Framework.  A new screen cast series called The Summer of NHibernate has been created to expose more developers to this technology. 

NHibernate is a port of the Java Hibernate Core to the Microsoft .NET Framework.  It is an Object-Relational Mapper (OR/M) whose purpose is persisting .NET objects to a relational database.  The term OR/M can give developers the impression of  complex configuration and steep learning curve. 

This does not need to be the case thanks to Steve Bohlen for creating The Summer of NHibernate screen cast series.  Steve describes the series as:

I am producing a series of successive screencast sessions that cover the complete use and implementation of NHibernate.  Called Summer of NHibernate, this series of screencasts is designed to take the newbie who knows nothing at all about NHibernate and teach them everything they need to know to start using NHibernate in a real-world application by the end of the hot summer months.  These screencasts will act as a set of reference materials that we can provide to new hires to help them get ramped up on the use of NHibernate in a short-order.

The series currently has a total of 6 sessions starting from the very basics of setting up and getting started with NHibernate to significant more detail.  Each screen cast runs about 90 minutes and detail of each new episode is posted along with the source code on the web site.

Example content of the first episode include:

Session 1 (6/13): SETUP AND BASIC USAGE PATTERN

  • Get the NHibernate dlls and .xsd files
  • Demonstrate how to add the xsd files to VS XML intellisense capabilities to get syntax support in the XML files
  • Use a simple Customer — Orders — OrderItems style database
  • Hand-code DTO class for the ‘Customer’ table
    • Introduce the concepts of 1:1 relation between table and class
    • (the dumb-DTO pattern; start here since it’s by far the simplest way to work)
  • Hand-code the Customer.hbm.xml mapping file to expose people to this syntax
  • Hand-code the hibernate.cfg.xml file to expose people to this syntax
  • Setup the project in VS (data access class lib)
  • Setup a corresponding test class to go along with it (to be used to exercise the data access class lib)
    • Further demonstrates the value of unit tests as a ‘harness’ for exercising concepts in a safe vacuum
  • Code a simple method that demonstrates the basic mechanics of interacting with NHibernate to retrieve all Customers from the database
    • ISessionFactory, ISession, reading configuration(s)
    • Leveraging the using ( ) {…} block to ensure session is properly closes/disposed of when done

 More information about the series can be found on The Summer of NHibernate web site and details of each episode can be found on Steven's blog.

No comments

Watch Thread Reply

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.