IMiddleware Interface

Definition

Represents middleware that can operate on incoming activities.

public interface IMiddleware
type IMiddleware = interface
Public Interface IMiddleware
Derived

Remarks

A BotAdapter passes incoming activities from the user's channel to the middleware's OnTurnAsync(ITurnContext, NextDelegate, CancellationToken) method.

You can add middleware objects to your adapter’s middleware collection. The adapter processes and directs incoming activities in through the bot middleware pipeline to your bot’s logic and then back out again. As each activity flows in and out of the bot, each piece of middleware can inspect or act upon the activity, both before and after the bot logic runs.

For each activity, the adapter calls middleware in the order in which you added it.

Methods

OnTurnAsync(ITurnContext, NextDelegate, CancellationToken)

When implemented in middleware, processes an incoming activity.

Applies to

See also