nhibernate/nhibernate-core — pull request #161 by ggeurts (2012-10-24 12:40:09+00:00)
Title: Refactoring of custom SQL code

Major refactoring of custom SQL code to reduce code duplication and simplify maintenance and bug fixes.

The following classes have been affected mostly:
- `NHibernate.Loader.Custom.Sql.SqlQueryReturnProcessor`

This class had 2 responsibilities. 1) It provided a lookup mechanism for persisters, suffixes and user-defined property result maps, based on raw information read from INativeSQLQueryReturn instances. 2) It transformed INativeSQLQueryReturn instances into NHibernate.Loader.Custom.IReturn instances for use by the NHibernate.Loader.Custom.CustomLoader.

The code related to the first responsibility has been moved into the new NHibernate.Loader.Custom.Sql.SqlQueryContext class. The code related to the second responsibility has been integrated into the NHibernate.Loader.Custom.Sql.SqlCustomQuery class.

- `NHibernate.Loader.Custom.NonScalarReturn`

The return transformation code that originally resided in NHibernate.Loader.Custom.Sql.SqlQueryReturnProcessor and now is part of NHibernate.Loader.Custom.Sql.SqlCustomQuery, was greatly simplified by removing all IReturn implementations that extend NonScalarResult and make the NonScalarResult class a bit smarter.

- `NHibernate.Loader.Custom.CustomQuery`

Removed code that adapted lookup functionality of NHibernate.Loader.Custom.Sql.SqlQueryReturnProcessor for use by NHibernate.Loader.Custom.Sql.SqlQueryParser class. This functionality is now directly provided by the new NHibernate.Loader.Custom.Sql.SqlQueryContext class.

Contains simplified code to transform INativeSQLQueryReturn instances into NHibernate.Loader.Custom.IReturn instances. This transformation code originates from the now defunct NHibernate.Loader.Custom.Sql.SqlQueryReturnProcessor class.

- `NHibernate.Loader.Custom.CustomLoader`

The constructor code has been simplified a lot because of the reduced number of IReturn implementations.