@@ -93,8 +93,8 @@ internal static void SetParameterTypes(
9393 continue ;
9494 }
9595
96- namedParameter . Type = GetParameterType ( sessionFactory , constantExpressions , visitor , namedParameter , out var tryProcessInHql ) ;
97- namedParameter . IsGuessedType = tryProcessInHql ;
96+ namedParameter . Type = GetParameterType ( sessionFactory , constantExpressions , visitor , namedParameter , out var isGuessedType ) ;
97+ namedParameter . IsGuessedType = isGuessedType ;
9898 }
9999 }
100100
@@ -147,9 +147,9 @@ private static IType GetParameterType(
147147 HashSet < ConstantExpression > constantExpressions ,
148148 ConstantTypeLocatorVisitor visitor ,
149149 NamedParameter namedParameter ,
150- out bool tryProcessInHql )
150+ out bool isGuessedType )
151151 {
152- tryProcessInHql = false ;
152+ isGuessedType = false ;
153153 // All constant expressions have the same type/value
154154 var constantExpression = constantExpressions . First ( ) ;
155155 var constantType = constantExpression . Type . UnwrapIfNullable ( ) ;
@@ -159,10 +159,7 @@ private static IType GetParameterType(
159159 return candidateType ;
160160 }
161161
162- if ( visitor . NotGuessableConstants . Contains ( constantExpression ) && constantExpression . Value != null )
163- {
164- tryProcessInHql = true ;
165- }
162+ isGuessedType = true ;
166163
167164 // No related MemberExpressions was found, guess the type by value or its type when null.
168165 // When a numeric parameter is compared to different columns with different types (e.g. Where(o => o.Single >= singleParam || o.Double <= singleParam))
@@ -174,13 +171,10 @@ private static IType GetParameterType(
174171
175172 private class ConstantTypeLocatorVisitor : RelinqExpressionVisitor
176173 {
177- private bool _hqlGenerator ;
178174 private readonly bool _removeMappedAsCalls ;
179175 private readonly System . Type _targetType ;
180176 private readonly IDictionary < ConstantExpression , NamedParameter > _parameters ;
181177 private readonly ISessionFactoryImplementor _sessionFactory ;
182- private readonly ILinqToHqlGeneratorsRegistry _functionRegistry ;
183- public readonly HashSet < ConstantExpression > NotGuessableConstants = new HashSet < ConstantExpression > ( ) ;
184178 public readonly Dictionary < ConstantExpression , IType > ConstantExpressions =
185179 new Dictionary < ConstantExpression , IType > ( ) ;
186180 public readonly Dictionary < NamedParameter , HashSet < ConstantExpression > > ParameterConstants =
@@ -198,7 +192,6 @@ public ConstantTypeLocatorVisitor(
198192 _targetType = targetType ;
199193 _sessionFactory = sessionFactory ;
200194 _parameters = parameters ;
201- _functionRegistry = sessionFactory . Settings . LinqToHqlGeneratorsRegistry ;
202195 }
203196
204197 protected override Expression VisitBinary ( BinaryExpression node )
@@ -269,16 +262,6 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
269262 return node ;
270263 }
271264
272- // For hql method generators we do not want to guess the parameter type here, let hql logic figure it out.
273- if ( _functionRegistry . TryGetGenerator ( node . Method , out _ ) )
274- {
275- var origHqlGenerator = _hqlGenerator ;
276- _hqlGenerator = true ;
277- var expression = base . VisitMethodCall ( node ) ;
278- _hqlGenerator = origHqlGenerator ;
279- return expression ;
280- }
281-
282265 return base . VisitMethodCall ( node ) ;
283266 }
284267
@@ -289,11 +272,6 @@ protected override Expression VisitConstant(ConstantExpression node)
289272 return node ;
290273 }
291274
292- if ( _hqlGenerator )
293- {
294- NotGuessableConstants . Add ( node ) ;
295- }
296-
297275 RelatedExpressions . Add ( node , new HashSet < Expression > ( ) ) ;
298276 ConstantExpressions . Add ( node , null ) ;
299277 if ( ! ParameterConstants . TryGetValue ( param , out var set ) )
0 commit comments