Skip to content

Commit 77526b1

Browse files
committed
Proper interceptor check
1 parent 986fa50 commit 77526b1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/NHibernate/Async/Engine/ForeignKeys.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ public static async Task<bool> IsNotTransientSlowAsync(string entityName, object
187187
}
188188

189189
// let the interceptor inspect the instance to decide
190-
if (session.Interceptor.IsTransient(entity) == true)
191-
return Task.FromResult<bool?>(true);
190+
if (session.Interceptor.IsTransient(entity) is bool transient)
191+
return Task.FromResult<bool?>(transient);
192192

193193
if (entity is INHibernateProxy proxy && proxy.HibernateLazyInitializer.IsUninitialized)
194194
{
195195
return Task.FromResult<bool?>(false);
196196
}
197197

198-
// let the persister inspect the instance to decide
198+
// let the persister inspect the instance to decide
199199
return session.GetEntityPersister(entityName, entity).IsTransientAsync(entity, session, cancellationToken);
200200
}
201201
catch (System.Exception ex)

src/NHibernate/Engine/ForeignKeys.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ public static bool IsNotTransientSlow(string entityName, object entity, ISession
179179
}
180180

181181
// let the interceptor inspect the instance to decide
182-
if (session.Interceptor.IsTransient(entity) == true)
183-
return true;
182+
if (session.Interceptor.IsTransient(entity) is bool transient)
183+
return transient;
184184

185185
if (entity is INHibernateProxy proxy && proxy.HibernateLazyInitializer.IsUninitialized)
186186
{
187187
return false;
188188
}
189189

190-
// let the persister inspect the instance to decide
190+
// let the persister inspect the instance to decide
191191
return session.GetEntityPersister(entityName, entity).IsTransient(entity, session);
192192
}
193193

0 commit comments

Comments
 (0)