With NH-4003, a transaction sharing mechanism between sessions has been introduced. It works by opening new sessions from another one, while using the Connection() option on the session builder.
When committing the NHibernate transaction with FlushMode.Commit, only the originating session get flushed. The other sessions should be flushed too.
There is the flush order which needs to be chosen.
It looks to me sensible to first flush the sessions having "inherited" their connection manager, in the order they were created. Then flush the originating session.
The originating session must have a longer life span than all other sessions, because it stays responsible for the connection manager. Closing it before other sessions renders them un-usable. That is why it looks to me sound to flush it last.
If the way the user uses the sessions causes him to need another flush order, he will have to manually issue them.
With NH-4003, a transaction sharing mechanism between sessions has been introduced. It works by opening new sessions from another one, while using the
Connection()
option on the session builder.When committing the NHibernate transaction with
FlushMode.Commit
, only the originating session get flushed. The other sessions should be flushed too.