Thursday, July 24, 2008

How to gain ORM and influence databases – NHibernate, The Summer Screencast Series

Summer of NHibernate Screencast Series

“The purpose of this site is to provide one-stop easy access to direct downloads of the screencasts. If you have feedback, comments, questions, etc. please visit my blog and post them there.

…”

Unhandled Exceptions - Summer of NHibernate Session 01: Setup and Basic Usage Pattern Screencast is Available

“I am pleased to announce that the first installment of the Summer NHibernate screencast series is finally available for download!

This first session covers the basic setup and usage patterns of the NHibernate object relational mapping technology and starts with the basics assuming no familiarity on the part of the user with NHibernate at all.  For background on the reasoning behind this video series refer to this previous post.

Screencast Session Outline

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

…”

ORM’s is another area where I feel I’m way behind the times in. I’ve been watching them for a while, but have stuck with my tried and true ADO.Net fugly coding pattern (code it once, cut-n-paste-n-tweak).

It’s getting to be that time were I start taking a serious look at this space. Either via a light weight ORM like Linq to SQL, or one of the heavier ones like NHibernate, Entity Framework, etc. First I need to get the Zen of it and I’m hoping these casts will help with that. I need to stop reading and start seeing (and then start doing  ;)

For more NHibernate resources make sure you click through to Scott’s post (below) as he included a short list of related links.

(via Scott Hanselman's ComputerZen.com - Learn How to use NHibernate with the Summer of NHibernate Screencast Series

No comments: