@@ -197,12 +197,13 @@ private static bool TraverseMembers(
197
197
IAbstractComponentType currentComponentType = null ;
198
198
while ( memberPaths . Count > 0 && currentType != null )
199
199
{
200
+ memberPath = member . Path ;
200
201
var convertType = member . ConvertType ;
202
+ member = memberPaths . Pop ( ) ;
201
203
202
204
switch ( currentType )
203
205
{
204
206
case IAssociationType associationType :
205
- member = memberPaths . Pop ( ) ;
206
207
ProcessAssociationType (
207
208
associationType ,
208
209
sessionFactory ,
@@ -213,24 +214,31 @@ private static bool TraverseMembers(
213
214
out currentComponentType ) ;
214
215
break ;
215
216
case IAbstractComponentType componentType :
216
- // Concatenate the component property path in order to be able to use EntityMetamodel.GetPropertyType to retrieve the type.
217
- // As GetPropertyType supports only components, do not concatenate when dealing with collection composite elements or elements.
218
- if ( ! currentType . IsAnyType )
217
+ currentComponentType = componentType ;
218
+ if ( currentEntityPersister == null )
219
219
{
220
- var nextMember = memberPaths . Pop ( ) ;
221
- member = currentEntityPersister == null // Collection with composite element or element
222
- ? nextMember
223
- : new MemberMetadata ( $ "{ member . Path } .{ nextMember . Path } ", nextMember . ConvertType , nextMember . HasIndexer ) ;
220
+ // When persister is not available (q.OneToManyCompositeElement[0].Prop), try to get the type from the component
221
+ currentType = TryGetComponentPropertyType ( componentType , member . Path ) ;
224
222
}
225
223
else
226
224
{
227
- member = memberPaths . Pop ( ) ;
225
+ if ( ! currentType . IsAnyType )
226
+ {
227
+ // Concatenate the component property path in order to be able to use EntityMetamodel.GetPropertyType to retrieve the type.
228
+ // As GetPropertyType supports only components, do not concatenate when dealing with collection composite elements or elements.
229
+ // q.Component.Prop
230
+ member = new MemberMetadata (
231
+ $ "{ memberPath } .{ member . Path } ",
232
+ member . ConvertType ,
233
+ member . HasIndexer ) ;
234
+ }
235
+
236
+ // q.Component.Prop
237
+ currentType = currentEntityPersister . EntityMetamodel . GetPropertyType ( member . Path ) ;
228
238
}
229
- currentComponentType = componentType ;
230
- ProcessComponentType ( componentType , currentEntityPersister , member , out currentType ) ;
239
+
231
240
break ;
232
241
default :
233
- member = memberPaths . Pop ( ) ;
234
242
// q.Prop.NotMappedProp
235
243
currentType = null ;
236
244
currentEntityPersister = null ;
@@ -257,24 +265,12 @@ private static bool TraverseMembers(
257
265
return false ;
258
266
}
259
267
260
- private static void ProcessComponentType (
261
- IAbstractComponentType componentType ,
262
- IEntityPersister persister ,
263
- MemberMetadata member ,
264
- out IType memberType )
268
+ private static IType TryGetComponentPropertyType ( IAbstractComponentType componentType , string memberPath )
265
269
{
266
- // When persister is not available (q.OneToManyCompositeElement[0].Prop), try to get the type from the component
267
- if ( persister == null )
268
- {
269
- var index = Array . IndexOf ( componentType . PropertyNames , member . Path ) ;
270
- memberType = index < 0
271
- ? null // q.OneToManyCompositeElement[0].NotMappedProp
272
- : componentType . Subtypes [ index ] ; // q.OneToManyCompositeElement[0].Prop
273
- return ;
274
- }
275
-
276
- // q.Component.Prop
277
- memberType = persister . EntityMetamodel . GetPropertyType ( member . Path ) ;
270
+ var index = Array . IndexOf ( componentType . PropertyNames , memberPath ) ;
271
+ return index < 0
272
+ ? null // q.OneToManyCompositeElement[0].NotMappedProp
273
+ : componentType . Subtypes [ index ] ; // q.OneToManyCompositeElement[0].Prop
278
274
}
279
275
280
276
private static void ProcessAssociationType (
@@ -299,7 +295,7 @@ private static void ProcessAssociationType(
299
295
{
300
296
case IAbstractComponentType componentType : // q.OneToManyCompositeElement[0].Member
301
297
memberComponent = componentType ;
302
- ProcessComponentType ( componentType , null , member , out memberType ) ;
298
+ memberType = TryGetComponentPropertyType ( componentType , member . Path ) ;
303
299
return ;
304
300
default : // q.OneToManyElement[0].Member
305
301
memberType = null ;
0 commit comments