Language

SlackExtensionAttribute Class

Definition

Marks an AgentApplication subclass to automatically receive a generated Slack property of type SlackAgentExtension.

[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public sealed class SlackExtensionAttribute : Microsoft.Agents.Builder.App.AgentExtensionAttribute<Microsoft.Agents.Extensions.Slack.SlackAgentExtension>
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)>]
type SlackExtensionAttribute = class
    inherit AgentExtensionAttribute<SlackAgentExtension>
Public NotInheritable Class SlackExtensionAttribute
Inherits AgentExtensionAttribute(Of SlackAgentExtension)
Inheritance
Attributes

Remarks

The decorated class must be declared as partial. When the class is compiled, a source generator creates a companion partial class that exposes a SlackAgentExtension through a Slack property. The extension is lazily initialized and registered with the application on first access.

[SlackExtension]
public partial class MyAgent(AgentApplicationOptions options) : AgentApplication(options)
{
    public MyAgent(AgentApplicationOptions options) : base(options)
    {
        SlackExtension.OnSlackMessage(OnSlackMessageAsync, rank: RouteRank.Last);
    }
}

Constructors

Name Description
SlackExtensionAttribute()

Applies to