Hi hoghweed,
AFAIK a session should not be used across threads, since session is
not thread safe.
Felix.

On Jan 7, 1:46 am, hoghweed <[email protected]> wrote:
> I'm building a sort of a state-machine server based on xml and json as
> description, a kind of "workflow server" (even if i hate workflows..)
> I'm using NH as persistence.  Thisea "server" is hosted in a Windows
> Service and makes usage of multithreading.
>
> The server receives notifications and messages, when a message arrives
> a NH session is spawned and lives through the life of a message, till
> here all could be fine.
> There are some messages which creates a new thread to perform some
> actions, and I need that threads using the same Session created in the
> message "context".
>
> I made a big error, as Ayende say everytime, I used a framework over
> NH, the framework is NCommon (https://github.com/riteshrao/ncommon)
> which use a kind of SessionScope which makes a kind of "context", so
> nested SessionScopes creates unit-of-work inside the outer, the first
> one created.
>
> I know NH use the ability to get a SessionContext where it's possible
> to bind a session in a particular context, so it's possible to get the
> current session from the sessionfactory.
>
> How to make possible to use the message-context-created session to
> threads created in this particular message-context? could a good idea
> to create a custom sessioncontext class, and associate a session to a
> kind of a message-id? if so, how, and what's the best way to associate
> that threads to that message-id?
> Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to