File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/NHibernate/Linq/Visitors Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,29 @@ private static IType GetCandidateType(
141
141
return candidateType ;
142
142
}
143
143
144
+ private static IType GetCandidateType (
145
+ ISessionFactoryImplementor sessionFactory ,
146
+ HashSet < ConstantExpression > constantExpressions ,
147
+ ConstantTypeLocatorVisitor visitor ,
148
+ System . Type constantType )
149
+ {
150
+ var candidateType = GetCandidateType ( sessionFactory , constantExpressions , visitor ) ;
151
+
152
+ if ( candidateType == null )
153
+ {
154
+ return null ;
155
+ }
156
+
157
+ // When comparing an integral column with a real parameter, the parameter type must remain real type
158
+ // and the column needs to be casted in order to prevent invalid results (e.g. Where(o => o.Integer >= 2.2d)).
159
+ if ( constantType . IsRealNumberType ( ) && candidateType . ReturnedClass . IsIntegralNumberType ( ) )
160
+ {
161
+ return null ;
162
+ }
163
+
164
+ return candidateType ;
165
+ }
166
+
144
167
private static IType GetParameterType (
145
168
ISessionFactoryImplementor sessionFactory ,
146
169
HashSet < ConstantExpression > constantExpressions ,
You can’t perform that action at this time.
0 commit comments