Hi Will.
SetSession is a specific NH API not documented and not tested, we can say: something hard to discover like a breaking change.
The comment on the method say:
"Called when a session-scoped (and only session scoped) interceptor is attached to a session"
But putting it in the private method mean that the method is used for any kind of interceptor.
I would like to know which is the definition and the use of SetSession and put the call only where it is needed.
Feel free to study the situation and send us a patch (including a simply test to prevent the same problem in the future).
Really thanks for you support and you contribution to NH prj.
Fabio.2008/6/18 Will Shaver <will.shaver@gmail.com>:Here's a patch adding the SetSession call back into the SessionFactory.-WillOn Wed, Jun 18, 2008 at 4:01 PM, Ayende Rahien <ayende@ayende.com> wrote:
Agreed.
On Thu, Jun 19, 2008 at 1:56 AM, Will Shaver <will.shaver@gmail.com> wrote:
I'm fine with fixing it so that SetSession is being called in the Session Factory too. I just think that we need to call it in the factory OR we should remove it from the Interceptor.-Will
On Wed, Jun 18, 2008 at 3:51 PM, Ayende Rahien <ayende@ayende.com> wrote:
Hm, this isn't really that good.Consider all the things that wrap NH. There was a reason this was there, because you don't always control the call to OpenSession
On Thu, Jun 19, 2008 at 1:40 AM, Will Shaver <will.shaver@gmail.com> wrote:-------------------------------------------------------------------------It looks like Fabio did a bunch of work last weekend refactoring the session factory and other session factory related stuff. Based on the amount of code that was changed, I'm sure it was needed. Merging my project to the trunk, I did find one breaking change.The previous versions called something like:(isSessionScopedInterceptor)
if
interceptor.SetSession(sessionImpl);
on each Interceptor registered with the session. This was useful in that you could then overload this in the interceptor and then keep a reference to that session. This is now removed, which is easy enough to deal with - simply call the method manually after creating the session.
session = sessionFactory.OpenSession(interceptor);
interceptor.SetSession(session);I of course only found out about this breaking change when running my interceptor unit tests. (How did I ever write software without unit tests? Who knows?!)
Instead, we should remove the SetSession(ISession session) method from the Interceptor interface and EmptyInterceptor implementation. This will force people to realize "ohh, if it isn't there, obviously it isn't being called by NHCore anymore." Then they will change it to non-virtual and call it themselves without needing to look into the source as I did...
- Will
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
--
Fabio Maulo
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development