Skip to content

Commit 616a1dd

Browse files
committed
Fixed ExecuteInserts
1 parent 391d231 commit 616a1dd

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/NHibernate/Async/Engine/ActionQueue.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,17 @@ private async Task InnerExecuteAsync(IExecutable executable, CancellationToken c
8585
/// Perform all currently queued entity-insertion actions.
8686
/// </summary>
8787
/// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
88-
public Task ExecuteInsertsAsync(CancellationToken cancellationToken)
88+
public async Task ExecuteInsertsAsync(CancellationToken cancellationToken)
8989
{
90-
if (cancellationToken.IsCancellationRequested)
90+
cancellationToken.ThrowIfCancellationRequested();
91+
try
9192
{
92-
return Task.FromCanceled<object>(cancellationToken);
93+
await ExecuteActionsAsync(insertions, cancellationToken);
94+
}
95+
finally
96+
{
97+
await AfterExecutionsAsync(cancellationToken);
9398
}
94-
return ExecuteActionsAsync(insertions, cancellationToken);
9599
}
96100

97101
/// <summary>

src/NHibernate/Engine/ActionQueue.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ private void RegisterCleanupActions(IExecutable executable)
199199
/// </summary>
200200
public void ExecuteInserts()
201201
{
202-
ExecuteActions(insertions);
202+
try
203+
{
204+
ExecuteActions(insertions);
205+
}
206+
finally
207+
{
208+
AfterExecutions();
209+
}
203210
}
204211

205212
/// <summary>

0 commit comments

Comments
 (0)