Application<TState>.AddRoute Method

Definition

Adds a new route to the application.

Developers won't typically need to call this method directly as it's used internally by all of the fluent interfaces to register routes for their specific activity types.

Routes will be matched in the order they're added to the application. The first selector to return true when an activity is received will have its handler called.

Invoke-based activities receive special treatment and are matched separately as they typically have shorter execution timeouts.

public Microsoft.Teams.AI.Application<TState> AddRoute(Microsoft.Teams.AI.RouteSelectorAsync selector, Microsoft.Teams.AI.RouteHandler<TState> handler, bool isInvokeRoute = false);
member this.AddRoute : Microsoft.Teams.AI.RouteSelectorAsync * Microsoft.Teams.AI.RouteHandler<'State (requires 'State :> Microsoft.Teams.AI.State.TurnState and 'State : (new : unit -> 'State))> * bool -> Microsoft.Teams.AI.Application<'State (requires 'State :> Microsoft.Teams.AI.State.TurnState and 'State : (new : unit -> 'State))>
Public Function AddRoute (selector As RouteSelectorAsync, handler As RouteHandler(Of TState), Optional isInvokeRoute As Boolean = false) As Application(Of TState)

Parameters

selector
RouteSelectorAsync

Function that's used to select a route. The function returning true triggers the route.

handler
RouteHandler<TState>

Function to call when the route is triggered.

isInvokeRoute
Boolean

Boolean indicating if the RouteSelectorAsync is for an activity that uses "invoke" which require special handling. Defaults to false.

Returns

The application instance for chaining purposes.

Applies to