ISessionStorage implementation for multithreading console application

180 views
Skip to first unread message

Alexl

unread,
Mar 26, 2009, 6:55:53 PM3/26/09
to S#arp Architecture
Hi,

I'm implementing an ISessionStorage for multithreading environment.

Actually the websessionstorage use the httpcontext to save a session
by session key.
I need to do the same process to save the nhibernate session by thread
identification, i don't know if there is a guid by thread or an
identifier.

Does anyone has implemented somethink like that ?

Billy

unread,
Mar 26, 2009, 6:59:51 PM3/26/09
to S#arp Architecture
Hi Alexl,

The NHibernate forums at http://forum.hibernate.org/viewforum.php?f=25
would be the best spot to have this question answered quickly and
comprehensively.

Billy

Simone Busoli

unread,
Mar 26, 2009, 7:00:30 PM3/26/09
to sharp-arc...@googlegroups.com
Take a look at unhaddins as well, they have several implementations.

David Archer

unread,
Apr 3, 2009, 2:33:30 PM4/3/09
to S#arp Architecture
Alex,

I ran into the same issue and am just using a simple thread static
variable for keeping sessions segregated by thread.

using System;
using NHibernate;
using SharpArch.Data.NHibernate;

namespace MyProject.Data.SharpArch
{
public class ThreadSessionStorage : ISessionStorage
{
[ThreadStatic]
private static ISession _session;

public ISession Session
{
get
{
return _session;
}
set
{
_session = value;
}
}
}
}


HTH,

David
Reply all
Reply to author
Forward
0 new messages