Skip to content

Commit 9f7856f

Browse files
committed
Merge two conditions to reduce complexity
1 parent 2682d60 commit 9f7856f

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/NHibernate/Util/ExpressionsHelper.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,12 @@ internal static bool TryGetMappedType(
121121

122122
// Try to retrive the starting entity name with all members that were traversed in that process
123123
var memberPaths = MemberMetadataExtractor.TryGetAllMemberMetadata(expression, out var entityName, out var convertType);
124-
if (memberPaths == null)
124+
if (memberPaths == null || !TryGetEntityPersister(entityName, null, sessionFactory, out var currentEntityPersister))
125125
{
126-
// Failed to find the starting entity name, due to an unsupported expression or the expression didn't contain
127-
// the IEntityNameProvider instance
128-
memberPath = null;
129-
mappedType = null;
130-
entityPersister = null;
131-
component = null;
132-
return false;
133-
}
134-
135-
if (!TryGetEntityPersister(entityName, null, sessionFactory, out var currentEntityPersister))
136-
{
137-
// Querying an unmapped type e.g. s.Query<IEntity>().Where(a => a.Type == "A")
126+
// Failed to find the starting entity name, due to:
127+
// - Unsupported expression
128+
// - The expression didn't contain the IEntityNameProvider instance
129+
// - Querying an unmapped type e.g. s.Query<IEntity>().Where(a => a.Type == "A")
138130
memberPath = null;
139131
mappedType = null;
140132
entityPersister = null;

0 commit comments

Comments
 (0)