Skip to content

Commit a8a01f0

Browse files
committed
Throw if FutureBatch is not supported
1 parent 7e34d3c commit a8a01f0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/NHibernate/Async/Engine/ISessionImplementor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using NHibernate.Persister.Entity;
2424
using NHibernate.Transaction;
2525
using NHibernate.Type;
26+
using NHibernate.Util;
2627

2728
namespace NHibernate.Engine
2829
{

src/NHibernate/Engine/ISessionImplementor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using NHibernate.Persister.Entity;
1414
using NHibernate.Transaction;
1515
using NHibernate.Type;
16+
using NHibernate.Util;
1617

1718
namespace NHibernate.Engine
1819
{
@@ -36,9 +37,10 @@ internal static IDisposable BeginProcess(this ISessionImplementor session)
3637
new SessionIdLoggingContext(session.SessionId);
3738
}
3839

40+
//6.0 TODO: Expose as ISessionImplementor.FutureBatch and replace method usages with property
3941
internal static IQueryBatch GetFutureBatch(this ISessionImplementor session)
4042
{
41-
return (session as AbstractSessionImpl)?.FutureBatch;
43+
return ReflectHelper.CastOrThrow<AbstractSessionImpl>(session, "future batch").FutureBatch;
4244
}
4345

4446
internal static void AutoFlushIfRequired(this ISessionImplementor implementor, ISet<string> querySpaces)

0 commit comments

Comments
 (0)