Skip to content

Commit 372dc28

Browse files
committed
Use variable for Interceptor check
1 parent 77526b1 commit 372dc28

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/NHibernate/Async/Engine/ForeignKeys.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ 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) is bool transient)
191-
return Task.FromResult<bool?>(transient);
190+
var isTransient = session.Interceptor.IsTransient(entity);
191+
if (isTransient.HasValue)
192+
return Task.FromResult<bool?>(isTransient);
192193

193194
if (entity is INHibernateProxy proxy && proxy.HibernateLazyInitializer.IsUninitialized)
194195
{

src/NHibernate/Engine/ForeignKeys.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ 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) is bool transient)
183-
return transient;
182+
var isTransient = session.Interceptor.IsTransient(entity);
183+
if (isTransient.HasValue)
184+
return isTransient;
184185

185186
if (entity is INHibernateProxy proxy && proxy.HibernateLazyInitializer.IsUninitialized)
186187
{

0 commit comments

Comments
 (0)