@@ -122,15 +122,15 @@ internal static string TryGetEntityName(
122122 // q.OneToMany[0].CompositeElement.Prop
123123 if ( entityName == null )
124124 {
125- var index = GetComponentPropertyIndex ( componentType , member . Path ) ;
126- if ( ! index . HasValue )
125+ var index = Array . IndexOf ( componentType . PropertyNames , member . Path ) ;
126+ if ( index < 0 )
127127 {
128128 memberPath = null ;
129129 memberType = null ;
130130 return null ;
131131 }
132132
133- type = componentType . Subtypes [ index . Value ] ;
133+ type = componentType . Subtypes [ index ] ;
134134 continue ;
135135 }
136136
@@ -283,20 +283,6 @@ private static string GetEntityName(
283283 return entityName ;
284284 }
285285
286- private static int ? GetComponentPropertyIndex ( IAbstractComponentType componentType , string name )
287- {
288- var names = componentType . PropertyNames ;
289- for ( var i = 0 ; i < names . Length ; i ++ )
290- {
291- if ( names [ i ] . Equals ( name ) )
292- {
293- return i ;
294- }
295- }
296-
297- return null ;
298- }
299-
300286 private static IType GetType (
301287 string entityName ,
302288 IType currentType ,
@@ -314,10 +300,11 @@ private static IType GetType(
314300 // q.OneToMany[0].CompositeElement.Prop
315301 if ( currentType is IAbstractComponentType componentType )
316302 {
317- var index = GetComponentPropertyIndex ( componentType , memberPath ) ;
318- return index . HasValue
319- ? componentType . Subtypes [ index . Value ]
320- : null ;
303+ var names = componentType . PropertyNames ;
304+ var index = Array . IndexOf ( names , memberPath ) ;
305+ return index < 0
306+ ? null
307+ : componentType . Subtypes [ index ] ;
321308 }
322309
323310 return null ;
@@ -336,8 +323,7 @@ private static IType GetType(
336323 // q.OneToMany[0]
337324 if ( currentType is IAssociationType associationType )
338325 {
339- var queryableCollection =
340- ( IQueryableCollection ) associationType . GetAssociatedJoinable ( sessionFactory ) ;
326+ var queryableCollection = ( IQueryableCollection ) associationType . GetAssociatedJoinable ( sessionFactory ) ;
341327 return queryableCollection . ElementType ;
342328 }
343329
0 commit comments