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 (http://www.igloocoder.net/wiki) and the code can be grabbed from the svn trunk (https://igloocoder.net:8443/svn/IglooCommons/trunk).

posted @ Friday, May 01, 2009 1:07 PM

Print

Comments on this entry:

# re: A little more WCF NHibernate

Left by Huseyin Tufekcilerli at 5/22/2009 7:28 AM
Gravatar
Thanks for the code, one thing though. It seems that the ISession objects created via factory are never disposed explicitly. The ITransaction objects are disposed on detach of NHibernateContextExtension but I couldn't see anything related to ISession. In my opinion we should call Session.Dispose() at the end of that Detach method, there is no reason to use that session instance after extensions got detached as far as I can see.

# re: A little more WCF NHibernate

Left by Yovanny Rod at 7/2/2009 9:13 AM
Gravatar
hi,
your svn server is not online. Can you please send me the iglooCommons libs?

thx a lot,

Yovanny R.

Your comment:



 (will not be displayed)


 
 
 
Please add 8 and 6 and type the answer here:
 

Live Comment Preview: