.NET Zone is brought to you in partnership with:

Ayende Rahien is working for Hibernating Rhinos LTD, a Israeli based company producing developer productivity tools for OLTP applications such as NHibernate Profiler (nhprof.com), Linq to SQL Profiler(l2sprof.com), Entity Framework Profiler (efprof.com) and more. Ayende is a DZone MVB and is not an employee of DZone and has posted 462 posts at DZone. You can read more from them at their website. View Full User Profile

RavenDB Session mManagement in the ASP.NET Web API

03.15.2012
| 3673 views |
  • submit to reddit

This was brought up in the mailing list, and I thought it was an interesting solution, therefore, this post.

image

A couple of things to note here. I would actually rather use the Initialize() / Dispose() methods for this, but the problem is that we don’t really have a way at the Dispose() to know if the action threw an exception. Hence, the need to capture the ExecuteAsync() operation.

For fun, you can also use the async session as well, which will integrate very nicely into the async nature of most of the Web API.

Published at DZone with permission of Ayende Rahien, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Imdadyano Yano replied on Thu, 2012/03/15 - 3:02am

Hi Ayende,

 I have a query in my mind that it is adivised to use Disposed method rather than finalize method. The reason is the dispose method overcome the overhead of finalize method. But i didnt find any proper example that explains that overhead with a proper scenario. I would appreciate if you could provide an example for this.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.