UnitOfWork.IsStarted
Patch to check that the Interceptor is set to transient instead of singleton
or some such
On Sat, Oct 11, 2008 at 2:02 AM, Will Shaver <[EMAIL PROTECTED]> wrote:
> I'm not sure what exactly I would patch. On review it is more a
> word-of-caution than something wrong with the Rhino code.
>
> I'll just use UnitOfWork.CurrentSession in my interceptor.
>
> While we're on the topic - is there a way to determine when a unit of work
> is started? I can't seem to find one (and would probably be willing to patch
> for that.) Previously I was using IInterceptor.AfterTransactionBegin, but
> that always necessitated starting a transaction before doing ANY work...
>
> Something like INHibernateInitializationAware but instead
>
> public
> interface IUnitOfWorkAware
> {
> void UnitOfWorkStarted();
> void UnitOfWorkResumed(); //for long unit of work
> void UnitOfWorkStopped();
> }
> still thinking about it, but I'd really just need started/resumed.
>
> -Will
>
>
>
>
> On Fri, Oct 10, 2008 at 4:46 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
>
>> 1/ to be session aware interecptor, you must be specified at OpenSession
>> time. Nhibernate supports configuration time interceptors, but they are not
>> session aware, for multi threading safety reasons
>> 2/ a patch would be welcome.
>>
>>
>> On Sat, Oct 11, 2008 at 1:40 AM, Will Shaver <[EMAIL PROTECTED]>wrote:
>>
>>> in NHibernateUnitOfWorkFactory
>>>
>>> if (IoC.Container.Kernel.HasComponent(typeof(IInterceptor)))
>>> {
>>> IInterceptor interceptor = IoC.Resolve<IInterceptor>();
>>> ...
>>>
>>> If the IInterceptor is set up in the windsor config with the default
>>> implementation it will be a singleton. When OpenSession is called in
>>> NHibernate it will:
>>>
>>> if (sessionLocalInterceptor != null)
>>> {
>>> sessionLocalInterceptor.SetSession(session);
>>> }
>>>
>>> So if we have more than one session open at once - easy to do for a web
>>> app - we could be causing a clobbering of the session stored in the
>>> interceptor right?
>>>
>>> If so, do you recommend that you
>>>
>>> #1 Use UnitOfWork.CurrentSession instead of relying on SetSession() with
>>> a local var
>>> #2 Set up the lifestyle of the Interceptor to be something other than
>>> singleton, and if so what?
>>>
>>> - Will
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" 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/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---