Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate session management in WCF application

Tags:

wcf

nhibernate

I am building a WCF application, using NHibernate for the persistence layer. A lot of documentation thats out there is about using NHibernate with ASP.NET applications. But very little on the best ways to manage NHibernate Sessions in a WCF application.

After reading up on Instance Management Techniques in WCF applications, I am going to use "per-call Services". Drawing parallel with ASP.NET, this is like opening NHibernate sessions on Application_BeginRequest and closing them on Application_EndRequest. Billy McCafferty's S#arp Architecture has a great example of doing this very elegantly. But I am finding it a little hard to use a similar concept in a WCF application.

Any code samples or pointers to blogs with examples, will be greatly appreciated.

like image 549
Rohit Agarwal Avatar asked May 22 '09 00:05

Rohit Agarwal


People also ask

How to maintain session in WCF rest service?

To maintain a web session between the service and client, the client needs to send cookies to the service. When the service is called in an AJAX fashion, sending cookies to the service is the web browser's responsibility.


1 Answers

http://www.igloocoder.com/archive/2009/04/23/wcf-and-nhibernate-redux.aspx -> https://igloocoder.net:8443/svn/IglooCommons/trunk/src/IglooCoder.Commons/WcfNhibernate/

like image 200
Matt Hinze Avatar answered Oct 16 '22 04:10

Matt Hinze