NH-3704

https://nhibernate.jira.com/browse/NH-3704
With unit tests