TurnContext Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides context for a turn of a bot.
public class TurnContext : IDisposable, Microsoft.Bot.Builder.ITurnContext
type TurnContext = class
interface ITurnContext
interface IDisposable
Public Class TurnContext
Implements IDisposable, ITurnContext
- Inheritance
-
TurnContext
- Implements
Remarks
Context provides information needed to process an incoming activity. The context object is created by a BotAdapter and persists for the length of the turn.
Constructors
TurnContext(BotAdapter, Activity) |
Initializes a new instance of the TurnContext class. |
TurnContext(ITurnContext, Activity) |
Initializes a new instance of the TurnContext class from another turncontext class to target an alternate Activity. |
Properties
Activity |
Gets the activity associated with this turn; or |
Adapter |
Gets the bot adapter that created this context object. |
BufferedReplyActivities |
Gets a list of activities to send when `context.Activity.DeliveryMode == 'expectReplies'. |
Locale |
Gets or sets the locale on this context object. |
Responded |
Gets a value indicating whether at least one response was sent for the current turn. |
TurnState |
Gets the services registered on this context object. |
Methods
DeleteActivityAsync(ConversationReference, CancellationToken) |
Deletes an existing activity. |
DeleteActivityAsync(String, CancellationToken) |
Deletes an existing activity. |
Dispose() |
Frees resources. |
Dispose(Boolean) |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
OnDeleteActivity(DeleteActivityHandler) |
Adds a response handler for delete activity operations. |
OnSendActivities(SendActivitiesHandler) |
Adds a response handler for send activity operations. |
OnUpdateActivity(UpdateActivityHandler) |
Adds a response handler for update activity operations. |
SendActivitiesAsync(IActivity[], CancellationToken) |
Sends a set of activities to the sender of the incoming activity. |
SendActivityAsync(IActivity, CancellationToken) |
Sends an activity to the sender of the incoming activity. |
SendActivityAsync(String, String, String, CancellationToken) |
Sends a message activity to the sender of the incoming activity. |
UpdateActivityAsync(IActivity, CancellationToken) |
Replaces an existing activity. |
Extension Methods
GetDebugger(ITurnContext) |
Extension method to get IDialogDebugger from TurnContext. |
TraceActivityAsync(ITurnContext, String, Object, String, String, CancellationToken) |
Sends a trace activity to the BotAdapter for logging purposes. |