Make default value of FlushMode configurable

Description

I've grown to prefer FlushMode.Commit, and would like to configure it as the default FlushMode for sessions that the ISessionFactory creates. I can't find a built-in way to do this. The options I see are:

  • Just set the FlushMode property after calling OpenSession. But I can't always do this because some of my code uses ThreadLocalSessionContext, which may call OpenSession for me.

  • Set the FlushMode on the ISession every time I touch it.

  • Create an ISessionFactoryImlementor wrapper which will set the appropriate FlushMode for me.

So I do have options, and the last option, writing a session factory wrapper, is definitely viable and non-intrusive. It just really feels like this should be a configurable option baked into NHibernate, just like DefaultEntityMode.

I think the ideal solution would be a new Configuration property - something like:

... which would affect the initial FlushMode of any sessions created by that session factory.

Environment

None

Activity

Show:
Alex Zaytsev
May 1, 2017 at 3:40 AM

Closing issues resolved in 4.1.0

Alex Zaytsev
February 22, 2015 at 10:45 PM

Merged to master @ 5684575c9a6c2b0e4ec91e78ab6d2f4682a77f60

Ricardo Peres
September 2, 2014 at 9:11 PM
Ricardo Peres
August 31, 2014 at 9:10 PM

Pull request: https://github.com/nhibernate/nhibernate-core/pull/310
Full implementation and unit tests

Daniel A. Schilling
June 11, 2014 at 7:38 PM

Could someone please correct the misspelling of "configurable" in the title for me? Thanks!

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created June 11, 2014 at 7:34 PM
Updated May 1, 2017 at 3:40 AM
Resolved February 22, 2015 at 10:45 PM
Who's Looking?