Skip to content

Commit ccf55b4

Browse files
committed
Move getting next member into swith-case blocks
1 parent c8a06f5 commit ccf55b4

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/NHibernate/Util/ExpressionsHelper.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,11 @@ private static bool TraverseMembers(
198198
while (memberPaths.Count > 0 && currentType != null)
199199
{
200200
var convertType = member.ConvertType;
201-
// Concatenate the component property path in order to be able to use EntityMetamodel.GetPropertyType to retrieve the type.
202-
// As GetPropertyType supports only components, do not concatenate when dealing with collection composite elements or elements.
203-
if (!currentType.IsAnyType && currentType is IAbstractComponentType)
204-
{
205-
var nextMember = memberPaths.Pop();
206-
member = currentEntityPersister == null // Collection with composite element or element
207-
? nextMember
208-
: new MemberMetadata($"{member.Path}.{nextMember.Path}", nextMember.ConvertType, nextMember.HasIndexer);
209-
}
210-
else
211-
{
212-
member = memberPaths.Pop();
213-
}
214201

215202
switch (currentType)
216203
{
217204
case IAssociationType associationType:
205+
member = memberPaths.Pop();
218206
ProcessAssociationType(
219207
associationType,
220208
sessionFactory,
@@ -225,10 +213,24 @@ private static bool TraverseMembers(
225213
out currentComponentType);
226214
break;
227215
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)
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);
224+
}
225+
else
226+
{
227+
member = memberPaths.Pop();
228+
}
228229
currentComponentType = componentType;
229230
ProcessComponentType(componentType, currentEntityPersister, member, out currentType);
230231
break;
231232
default:
233+
member = memberPaths.Pop();
232234
// q.Prop.NotMappedProp
233235
currentType = null;
234236
currentEntityPersister = null;

0 commit comments

Comments
 (0)