WCF and nHibernate redux

A while back I posted about a small framework that I wrote to make handling of nHibernate Sessions easier in a WCF world.  There were a couple of problems with it and I've spent some time fixing it recently.  The entries on the wiki have been updated to fix problems in the documentation as well.

The big changes in the framework were a bug fix that was preventing the commit from being run, moving to the latest version of nHibernate, and making better use of nHibernate transactions.  The svn source code repository is available here.  If you get it and run the b.bat at the root of the trunk you will be able to grab the latest artifacts from the release folder that is created in the trunk.

posted @ Thursday, April 23, 2009 8:02 AM

Print

Comments on this entry:

# re: WCF and nHibernate redux

Left by Andreas Öhlund at 4/23/2009 11:46 PM
Gravatar
I tried to register on the wiki to add som comments but got no confirm email, posting my comment here instead:

You can rollback the unitof work using wcf error handlers, i'm currently doing it this way:
public class UnitOfWorkErrorHandler : IErrorHandler
{
private readonly ILog logger;

public UnitOfWorkErrorHandler(ILog logger)
{
this.logger = logger;
}

public void ProvideFault(Exception error, MessageVersion version, ref Message fault)
{
var unitOfWork = StructureMapCacheExtension.Current.Items["unit_of_work"] as IUnitOfWork;

if (unitOfWork == null)
throw new ApplicationException("Unit of work not found in operation context cache");


unitOfWork.Rollback();

logger.ErrorFormat("Exception in service, UoW is rolled back: {0}", error.ToString());

}

public bool HandleError(Exception error)
{

return false;
}
}

# re: WCF and nHibernate redux

Left by Paul Campbell at 2/11/2010 2:34 PM
Gravatar
Hi there,

Is this code still available at all?

Thanks,

Paul

# re: WCF and nHibernate redux

Left by administrator at 3/3/2010 11:57 AM
Gravatar
Hey Paul.

The code is all still available through my SVN server. You can find the address at http://www.igloocoder.net/wiki

Your comment:



 (will not be displayed)


 
 
 
Please add 8 and 4 and type the answer here:
 

Live Comment Preview: