ISessionStorage implementation for multithreading console application

180 vues
Accéder directement au premier message non lu

Alexl

non lue,
26 mars 2009, 18:55:5326/03/2009
à 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

non lue,
26 mars 2009, 18:59:5126/03/2009
à 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

non lue,
26 mars 2009, 19:00:3026/03/2009
à sharp-arc...@googlegroups.com
Take a look at unhaddins as well, they have several implementations.

David Archer

non lue,
3 avr. 2009, 14:33:3003/04/2009
à 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
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message