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(IChannelAdapter, IActivity) |
Initializes a new instance of the TurnContext class. |
| TurnContext(ITurnContext, IActivity) |
Initializes a new instance of the ITurnContext class from another TurnContext class to target an alternate Activity. |
TurnContext(IChannelAdapter, IActivity)
Initializes a new instance of the TurnContext class.
public TurnContext(Microsoft.Agents.Builder.IChannelAdapter adapter, Microsoft.Agents.Core.Models.IActivity activity);
new Microsoft.Agents.Builder.TurnContext : Microsoft.Agents.Builder.IChannelAdapter * Microsoft.Agents.Core.Models.IActivity -> Microsoft.Agents.Builder.TurnContext
Public Sub New (adapter As IChannelAdapter, activity As IActivity)
Parameters
- adapter
- IChannelAdapter
The adapter creating the context.
- activity
- IActivity
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 Adapter implementations only.
Applies to
TurnContext(ITurnContext, IActivity)
Initializes a new instance of the ITurnContext class from another TurnContext class to target an alternate Activity.
public TurnContext(Microsoft.Agents.Builder.ITurnContext turnContext, Microsoft.Agents.Core.Models.IActivity activity);
new Microsoft.Agents.Builder.TurnContext : Microsoft.Agents.Builder.ITurnContext * Microsoft.Agents.Core.Models.IActivity -> Microsoft.Agents.Builder.TurnContext
Public Sub New (turnContext As ITurnContext, activity As IActivity)
Parameters
- turnContext
- ITurnContext
context to clone.
- activity
- IActivity
activity to put into the new turn context.
Remarks
For supporting calling legacy systems that always assume ITurnContext.Activity is the activity should be processed. This class clones the TurnContext and then replaces the original.activity with the passed in activity.