Refactor ThreadLocalSessionContext

Description

Currently ThreadLocalSessionContext does not inherit from CurrentSessionContext, and as such, it is not possible to use it with the static methods CurrentSessionContext.Bind() and Unbind(). However, unexperienced developers may be fooled into that, and may find themselves in trouble.
If it is considered that this implementation offers advantages over ThreadStaticSessionContext, it would be useful to properly implement it so that it can be used; otherwise, just remove it or mark it as obsolete.

Environment

None

Activity

Show:
Alex Zaytsev
September 14, 2017 at 1:57 AM

Move minor and trivial improvements to 5.1

Alex Zaytsev
September 14, 2017 at 1:47 AM

Move issues from 4.2 to 5.0

Frédéric Delaporte
June 20, 2017 at 8:24 PM

Now that https://nhibernate.jira.com/browse/NH-4032#icft=NH-4032 is merged, do we obsolete that ThreadLocalSessionContext, or do we finish its implementation?

Frédéric Delaporte
June 13, 2017 at 10:13 PM

ThreadLocalSessionContext main advantage over ThreadStaticSessionContext is the support of multiple session factories used within the same context (thread). With NH-4032, it will lose that advantage.

Other points are its ability to open a session "on the fly" instead of yielding null as all other contextes, and a sort of "auto-cleanup" when user bind a new session without having unbound the previous one. Those abilities do not make much sens without some documented behaviors it does not actually implements: at least auto-closing session on transaction end, and the forbidden usage of session without transactions.

Alex Zaytsev
August 12, 2016 at 4:40 AM

Move unresolved improvements and new features with minor and trivial priorities to 4.2.0

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created February 17, 2013 at 11:02 AM
Updated April 11, 2018 at 3:48 PM
Who's Looking?