SqlClientBatchingBatcher incorrectly ignoring per-SessionFactory Settings properties

Description

EXPECTED:
Setting "command_timeout" in the Configuration properties affects commands created from the so configured session factory.

OBSERVED:
Setting "command_timeout" in the Configuration has no effect when using SqlClientBatchingBatcher, and instead the command timeout is read from the global Envrionment.Properties values.

Rationale:

Setting defined properties on a per-Configuration basis should affect the outcome of dependent factories created from the Configuration instance. This is just the least surprising thing to do, since that is the purpose of the Configuration object. Since an IBatcherFactory is created from a SessionFactory, it should obey the same configuration, not exclusively the global configuration. Other developers have discovered the same problem independently (http://ronaldrosiernet.azurewebsites.net/Blog/2013/04/20/timeout_in_nhibernate_batched_sessions)

Notes to implementors:

It would seem to me that SessionFactory.CreateBatcherFactory should do some detection on the ctor of the IBatcherFactory implementation, or else have some kind of Init method which gets the Settings instance down to the batcher factory on a per-sessionfactory basis. The IBatcherFactory could then pass the Settings instance down to the actual IBatcher which can make use of the configured properties.

Environment

None

Assignee

Alex Zaytsev

Reporter

RoryR

Labels

Components

Fix versions

Affects versions

Priority

Minor
Configure