Unhandled Exceptions

12 Jul

Summer of NHibernate Session 04 Screencast is Available

I have just posted the 5th installment in the Summer of NHibernate screencast series for general download.  This latest session covers the following main topics:

  1. Controlling Transactions in NHibernate (including Commit() and Rollback() methods
  2. NHibernate support for optimistic concurrency using the <version …> and <timestamp…> mapping elements

In addition, we further evolve the structure of our NHibernateDataProvider class to solve an insidious bug that crept into the code and resulted in some brittle tests that pass when run by themselves yet fail when run as a group — and this gives us a chance to dig into understanding more about the proper role of the ISession and ISessionFactory and their relationship to each other in any NHibernate-based DAL.

We also refactor most of our DAL methods to leverage the C# using (…) code blocks to easily ensure that we properly close and dispose of our ISessions and our ITransactions (sorry, you VB.NET guys will have to do without since there ain’t no such allegory in VB.NET…but you will all have XML-literals to keep you warm at night and we C#-heads will have to continue to struggle through with the XML DOM model smile_cry).

We also finally achieve that panacea sought after by all developers who write unit tests: 100% code coverage of our production code smile_teeth and in the process demonstrate how to write unit tests that properly exercise code-paths that lead to failure in addition to those code-paths that lead to success — both are equally valuable in ensuring that our tests correctly exercise our code.

As always, any comments, feedback, etc. are welcome.

© 2014 Unhandled Exceptions | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo