Hi team. I done a "minor" refactoring around parameters. To avoid to touch everything, the begin of the refactoring is in QueryLoader,cs. We already have a series of classes to manage parameters (see namespace NHibernate.Param). Those classes was completely rewrote to give them a real effective usage.
If you use those same classes even for Criteria we should have the whole matter solved. The work is not completely done because you have to review all Loader inheritance (basically for ProcessFilters and some other stuff). I found some dead code or, at least, some code not reached by our tests (see AggregatedIndexCollectionSelectorParameterSpecifications). For HQL/LINQ: Each Parameter (class Parameter) is now marked for back-tracking in practice a Parameter is created with the same ID of a IParameterSpecification. In this way all SqlString modifiers (Dialect for pagination, HQL-Functions, Filters) can move a Parameter around the query and we can always find them later. The certain-sequence of single SqlType (the result of a hql-parameter "deploy") is required, so far, because: IType.NullSafeSet(System.Data.IDbCommand , object, int, ISessionImplementor) When you will modify that method to accept int[] you will be able to move each single IDbParameter safely. The work has some nice improvement (at least when the whole work will be done): - positional parameter can now appear before,after or mixed to named-parameter, filters, pagination and so on - various methods/classes can be removed (including a bunch of properties in the dialect related to pagination) - QueryParameters can be simplified (it should hold just IParameterSpecification) - named-parameters, even when used inside a filter. used more than once are now translated in just one IDbParameter (you should find something else than Parameter.ParameterPosition to influence the final name of the parameter) Others TODO: find all issues tickets related to parameters values assignations, write/import the test, resolve the JIRA ticket. P.S. I have used "you" and not "we"... but you already know the reason. -- Fabio Maulo
