yes, that, AFAIK, does not work out of the box. Up to know the following thoughts come to my mind:
How does ISessionFactoryHolder react to multiple threads? Does it generate one session factory holder or one for each thread?
Looking at ThreadScopeInfo.cs:26 we see this code
[ThreadStatic] static Stack stack;
This clearly tells that we have a new stack of of session scopes for each thread.
Googling around i've came to
this post. It suggested to just register your own thread-safe implementation of IThreadScopeInfo.
While I think that is OK and might solve the problem, but why reinvent, whenc Castle.ActiveRecord already provides the following implementations of IThreadScopeInfo:
- AbstractThreadScopeInfo - this is used as an abstract implementation, not useful
- HybridWebThreadScopeInfo - the docs say: This is used for scenarios where most of the you need per request scope, but you also does some work outside a request (in a thread pool thread, for instnace).
- ThreadScopeAccessor - This is just an accessor, and does not provide single scope for all threads
- ThreadScopeInfo - this is the default implementation, which has static instances per-thread
- WebThreadScopeInfo - this implements a Session Per Request pattern pattern, So not useful
So, no helpful implementation, so will do the same as suggested
here. But, really, i hate copy-paste things, that's pure evil