@@ -192,32 +192,12 @@ private static bool TraverseMembers(
192
192
{
193
193
// Traverse the members that were traversed by the TryGetAllMemberMetadata method in the reverse order and try to keep
194
194
// tracking the entity persister until all members are traversed.
195
- System . Type convertType ;
196
195
var member = memberPaths . Pop ( ) ;
197
196
var currentType = currentEntityPersister . EntityMetamodel . GetPropertyType ( member . Path ) ;
198
197
IAbstractComponentType currentComponentType = null ;
199
- while ( true )
198
+ while ( memberPaths . Count > 0 && currentType != null )
200
199
{
201
- // When traversed to the top of the expression, return the current tracking values
202
- if ( memberPaths . Count == 0 )
203
- {
204
- memberPath = currentEntityPersister != null || currentComponentType != null ? member . Path : null ;
205
- mappedType = GetType ( currentEntityPersister , currentType , member , sessionFactory , out _ ) ;
206
- entityPersister = currentEntityPersister ;
207
- component = currentComponentType ;
208
- return mappedType != null ;
209
- }
210
-
211
- if ( currentType == null ) // Member not mapped
212
- {
213
- memberPath = null ;
214
- mappedType = null ;
215
- entityPersister = null ;
216
- component = null ;
217
- return false ;
218
- }
219
-
220
- convertType = member . ConvertType ;
200
+ var convertType = member . ConvertType ;
221
201
// Concatenate the component property path in order to be able to use EntityMetamodel.GetPropertyType to retrieve the type.
222
202
// As GetPropertyType supports only components, do not concatenate when dealing with collection composite elements or elements.
223
203
if ( ! currentType . IsAnyType && currentType is IAbstractComponentType )
@@ -256,6 +236,23 @@ private static bool TraverseMembers(
256
236
break ;
257
237
}
258
238
}
239
+
240
+ // When traversed to the top of the expression, return the current tracking values
241
+ if ( memberPaths . Count == 0 )
242
+ {
243
+ memberPath = currentEntityPersister != null || currentComponentType != null ? member . Path : null ;
244
+ mappedType = GetType ( currentEntityPersister , currentType , member , sessionFactory , out _ ) ;
245
+ entityPersister = currentEntityPersister ;
246
+ component = currentComponentType ;
247
+ return mappedType != null ;
248
+ }
249
+
250
+ // Member not mapped
251
+ memberPath = null ;
252
+ mappedType = null ;
253
+ entityPersister = null ;
254
+ component = null ;
255
+ return false ;
259
256
}
260
257
261
258
private static void ProcessComponentType (
0 commit comments