uncategorized

A little more WCF NHibernate

As part of my recent changes to the WCF-NHibernate code I have, I declared that there wasn’t going to be a way to handle automatic transaction rollbacks when WCF faults were going to be raised. I wasn’t even sure that I wanted them in tool. Andreas Öhlund pointed out that rollback could be handled quite nicely using the IErrorHandler interface within WCF. After some toying around with the idea and some proof-of-concept implementations, I decided to add this ability in.

Currently you identify a WCF service as using the NHibernate code by adding a [NHibernateContext] attribute to the .svc.cs file. I wanted to keep that syntax, and the rollback capability, as clean as possible. Rather than adding another attribute, I parameterized the existing one. Now you can indicate that the service should automatically rollback the NHibernate transaction when WCF Faults are being raised simply by attributing the .svc.cs file with [NHibernateContext(Rollback.Automatically)]. The default [NHibernateContext] requires manual rollbacks and exists as such for backwards compatibility.

More information can be found over on the wiki (https://www.igloocoder.net/wiki) and the code can be grabbed from the svn trunk (https://igloocoder.net:8443/svn/IglooCommons/trunk).