TurnContext Constructors
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.
Overloads
| 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. |
TurnContext(BotAdapter, Activity)
Initializes a new instance of the TurnContext class.
public TurnContext(Microsoft.Bot.Builder.BotAdapter adapter, Microsoft.Bot.Schema.Activity activity);
new Microsoft.Bot.Builder.TurnContext : Microsoft.Bot.Builder.BotAdapter * Microsoft.Bot.Schema.Activity -> Microsoft.Bot.Builder.TurnContext
Public Sub New (adapter As BotAdapter, activity As Activity)
Parameters
- adapter
- BotAdapter
The adapter creating the context.
- activity
- Activity
The incoming activity for the turn;
or null for a turn for a proactive message.
Exceptions
activity or
adapter is null.
Remarks
For use by bot adapter implementations only.
Applies to
TurnContext(ITurnContext, Activity)
Initializes a new instance of the TurnContext class from another turncontext class to target an alternate Activity.
public TurnContext(Microsoft.Bot.Builder.ITurnContext turnContext, Microsoft.Bot.Schema.Activity activity);
new Microsoft.Bot.Builder.TurnContext : Microsoft.Bot.Builder.ITurnContext * Microsoft.Bot.Schema.Activity -> Microsoft.Bot.Builder.TurnContext
Public Sub New (turnContext As ITurnContext, activity As Activity)
Parameters
- turnContext
- ITurnContext
context to clone.
- activity
- Activity
activity to put into the new turn context.
Remarks
For supporting calling legacy systems that always assume turncontext.Activity is the activity should be processed. This class clones the turncontext and then replaces the original.activity with the passed in activity.