Share via


AutoSaveStateMiddleware.OnTurnAsync Method

Definition

Before the turn ends, calls SaveChangesAsync(ITurnContext, Boolean, CancellationToken) on each state object.

public System.Threading.Tasks.Task OnTurnAsync (Microsoft.Bot.Builder.ITurnContext turnContext, Microsoft.Bot.Builder.NextDelegate next, System.Threading.CancellationToken cancellationToken = default);
abstract member OnTurnAsync : Microsoft.Bot.Builder.ITurnContext * Microsoft.Bot.Builder.NextDelegate * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnTurnAsync : Microsoft.Bot.Builder.ITurnContext * Microsoft.Bot.Builder.NextDelegate * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function OnTurnAsync (turnContext As ITurnContext, next As NextDelegate, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

turnContext
ITurnContext

The context object for this turn.

next
NextDelegate

The delegate to call to continue the bot middleware pipeline.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Implements

Remarks

This middleware persists state after the bot logic completes and before the turn ends.

Applies to