Skip to content

Commit 8f9e995

Browse files
committed
Move back wrong check to IsNotTransientSlow
1 parent fe8fedc commit 8f9e995

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/NHibernate/Async/Engine/ForeignKeys.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ private async Task<bool> IsNullifiableAsync(string entityName, object obj, Cance
157157
public static async Task<bool> IsNotTransientSlowAsync(string entityName, object entity, ISessionImplementor session, CancellationToken cancellationToken)
158158
{
159159
cancellationToken.ThrowIfCancellationRequested();
160+
if (entity.IsProxy())
161+
return true;
162+
if (session.PersistenceContext.IsEntryFor(entity))
163+
return true;
160164
return !await (IsTransientSlowAsync(entityName, entity, session, cancellationToken)).ConfigureAwait(false);
161165
}
162166

@@ -180,9 +184,6 @@ public static async Task<bool> IsNotTransientSlowAsync(string entityName, object
180184
return false;
181185
}
182186

183-
if (session.PersistenceContext.IsEntryFor(entity))
184-
return false;
185-
186187
// let the interceptor inspect the instance to decide
187188
// let the persister inspect the instance to decide
188189
return session.Interceptor.IsTransient(entity) ??

src/NHibernate/Engine/ForeignKeys.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ private bool IsNullifiable(string entityName, object obj)
155155
/// </remarks>
156156
public static bool IsNotTransientSlow(string entityName, object entity, ISessionImplementor session)
157157
{
158+
if (entity.IsProxy())
159+
return true;
160+
if (session.PersistenceContext.IsEntryFor(entity))
161+
return true;
158162
return !IsTransientSlow(entityName, entity, session);
159163
}
160164

@@ -177,9 +181,6 @@ public static bool IsNotTransientSlow(string entityName, object entity, ISession
177181
return false;
178182
}
179183

180-
if (session.PersistenceContext.IsEntryFor(entity))
181-
return false;
182-
183184
// let the interceptor inspect the instance to decide
184185
// let the persister inspect the instance to decide
185186
return session.Interceptor.IsTransient(entity) ??

0 commit comments

Comments
 (0)