From: <fab...@us...> - 2011-06-13 12:51:53
|
Revision: 5919 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5919&view=rev Author: fabiomaulo Date: 2011-06-13 12:51:47 +0000 (Mon, 13 Jun 2011) Log Message: ----------- Refactoring: Extracted extensions method Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2011-06-13 12:48:08 UTC (rev 5918) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2011-06-13 12:51:47 UTC (rev 5919) @@ -453,7 +453,7 @@ sqlString = PreprocessSQL(sqlString, queryParameters, session.Factory.Dialect); // After the last modification to the SqlString we can collect all parameters types. - ResetEffectiveExpectedType(parameterSpecs, queryParameters); // <= TODO: remove this method when we can infer the type during the parse + parameterSpecs.ResetEffectiveExpectedType(queryParameters); return new SqlCommandImpl(sqlString, parameterSpecs, queryParameters, session.Factory); } @@ -652,13 +652,5 @@ } return sqlString; } - - private void ResetEffectiveExpectedType(IEnumerable<IParameterSpecification> parameterSpecs, QueryParameters queryParameters) - { - foreach (var parameterSpecification in parameterSpecs.OfType<IExplicitParameterSpecification>()) - { - parameterSpecification.SetEffectiveType(queryParameters); - } - } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2011-06-13 12:48:08 UTC (rev 5918) +++ trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2011-06-13 12:51:47 UTC (rev 5919) @@ -369,7 +369,7 @@ sqlString = PreprocessSQL(sqlString, queryParameters, session.Factory.Dialect); // After the last modification to the SqlString we can collect all parameters types. - ResetEffectiveExpectedType(parameterSpecs, queryParameters); // <= TODO: remove this method when we can infer the type during the parse + parameterSpecs.ResetEffectiveExpectedType(queryParameters); return new SqlCommand.SqlCommandImpl(sqlString, parameterSpecs, queryParameters, session.Factory); } @@ -411,14 +411,6 @@ return sqlString; } - private void ResetEffectiveExpectedType(IEnumerable<IParameterSpecification> parameterSpecs, QueryParameters queryParameters) - { - foreach (var parameterSpecification in parameterSpecs.OfType<IExplicitParameterSpecification>()) - { - parameterSpecification.SetEffectiveType(queryParameters); - } - } - public IType[] ResultTypes { get { return resultTypes; } Modified: trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs 2011-06-13 12:48:08 UTC (rev 5918) +++ trunk/nhibernate/src/NHibernate/Param/ParametersBackTrackExtensions.cs 2011-06-13 12:51:47 UTC (rev 5919) @@ -38,6 +38,15 @@ return typesSequence.SelectMany(t => t.SqlTypes(factory)).ToArray(); } + public static void ResetEffectiveExpectedType(this IEnumerable<IParameterSpecification> parameterSpecs, QueryParameters queryParameters) + { + // TODO: remove this method when we can infer the type during the parse + foreach (var parameterSpecification in parameterSpecs.OfType<IExplicitParameterSpecification>()) + { + parameterSpecification.SetEffectiveType(queryParameters); + } + } + /// <summary> /// Influence the final name of the parameter. /// </summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |