Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 10 | Comments: 37

filter by tags archive

NHibernate and WCF

time to read 1 min | 194 words

I have run into some conceptual issues with using NHibernate with WCF. At the most basic level, I sought to duplicate the Session-Pre-Request functionality that I currently use for the web. This relies on the BeginRequest EndRequest events to create and close NHibernate's session.

Appernatly there is nothing in WCF that is similar to this, at least not globally. It has been suggested that I can use IDispatchMessegeInsepctor* to open/close the NHibernate session. This is good enough for the common case, althought it is still more work than I would like (you need to add the behavior to each service, instead of doing it globally).

One interesting thing that occured to me is using WCF PerSession services with NHibernate. Since NHibernate is now much more aggresive about release database connections, it make much more sense to use WCF PerSession while utilizing the Session Per Conversation pattern for NHibernate. This, however, I am not sure how to handle transperantly to the service...

* By the way, is someone else is strunk by how similar WCF is to the way Castle Windsor works?


Comments

Tim Scott

This might be a little off topic, but since you're using WCF and NHibernate, I though you might find interest in an article that I wrote with Greg Banister about our experience building an app using WCF and NHibernate:

http://lunaverse.wordpress.com/2007/05/09/remoting-using-wcf-and-nhibernate/

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. Production postmortem: The case of the memory eater and high load - one day from now
  2. Production postmortem: The case of the lying configuration file - about one day from now
  3. Production postmortem: The industry at large - 3 days from now
  4. The insidious cost of allocations - 4 days from now
  5. Find the bug: The concurrent memory buster - 5 days from now

And 4 more posts are pending...

There are posts all the way to Sep 10, 2015

RECENT SERIES

  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    14 Aug 2015 - The case of the man in the middle
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats