@@ -120,32 +120,28 @@ private static HashSet<IType> GetCandidateTypes(
120
120
IEnumerable < ConstantExpression > constantExpressions ,
121
121
ConstantTypeLocatorVisitor visitor )
122
122
{
123
- var parameterRelatedExpressions = new List < Expression > ( ) ;
123
+ var candidateTypes = new HashSet < IType > ( ) ;
124
124
foreach ( var expression in constantExpressions )
125
125
{
126
126
if ( visitor . RelatedExpressions . TryGetValue ( expression , out var relatedExpressions ) )
127
127
{
128
- parameterRelatedExpressions . AddRange ( relatedExpressions ) ;
129
- }
130
- }
131
-
132
- var candidateTypes = new HashSet < IType > ( ) ;
133
- // In order to get the actual type we have to check first the related member expressions, as
134
- // an enum is translated in a numeric type when used in a BinaryExpression and also it can be mapped as string.
135
- // By getting the type from a related member expression we also get the correct length in case of StringType
136
- // or precision when having a DecimalType.
137
- foreach ( var relatedExpression in parameterRelatedExpressions )
138
- {
139
- if ( ExpressionsHelper . TryGetMappedType ( sessionFactory , relatedExpression , out var candidateType , out _ , out _ , out _ ) )
140
- {
141
- if ( candidateType . IsAssociationType && visitor . SequenceSelectorExpressions . Contains ( relatedExpression ) )
128
+ // In order to get the actual type we have to check first the related member expressions, as
129
+ // an enum is translated in a numeric type when used in a BinaryExpression and also it can be mapped as string.
130
+ // By getting the type from a related member expression we also get the correct length in case of StringType
131
+ // or precision when having a DecimalType.
132
+ foreach ( var relatedExpression in relatedExpressions )
142
133
{
143
- var collection =
144
- ( IQueryableCollection ) ( ( IAssociationType ) candidateType ) . GetAssociatedJoinable ( sessionFactory ) ;
145
- candidateType = collection . ElementType ;
146
- }
134
+ if ( ExpressionsHelper . TryGetMappedType ( sessionFactory , relatedExpression , out var candidateType , out _ , out _ , out _ ) )
135
+ {
136
+ if ( candidateType . IsAssociationType && visitor . SequenceSelectorExpressions . Contains ( relatedExpression ) )
137
+ {
138
+ var collection = ( IQueryableCollection ) ( ( IAssociationType ) candidateType ) . GetAssociatedJoinable ( sessionFactory ) ;
139
+ candidateType = collection . ElementType ;
140
+ }
147
141
148
- candidateTypes . Add ( candidateType ) ;
142
+ candidateTypes . Add ( candidateType ) ;
143
+ }
144
+ }
149
145
}
150
146
}
151
147
0 commit comments