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.
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
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.