c# - 表单流枚举提示错误

标签 c# botframework formflow

当我使用 FormFlow 时,我有一个字段:

public enum Categories
{
    [Describe("Inquiry / Help")]
    InquiryHelp = 1,
    [Describe("Audio / Video & TV")]
    AVandTV,
    [Describe("Consulting & Data Analysis")]
    Consulting,
    [Describe("Email / Calendar & Collaboration")]
    Email,
    [Describe("IDs / Accounts & Access")]
    Accounts,
    [Describe("Network Services")]
    Network,
    [Describe("Phone Services")]
    Phone,
    [Describe("Radio & Microwave Services")]
    Radio,
    [Describe("Security & Policies")]
    Security,
    [Describe("Servers & Data Storage")]
    Servers,
    [Describe("Software & Business Applications")]
    Software,
    [Describe("Tech Support & Training")]
    TechSupport,
    [Describe("Websites / Design & Hosting")]
    Websites
}

[Optional]
[Describe("the appropriate category")]
[Prompt(new string[] { "Please select the appropriate category for your problem (optional)." })]
public Categories Category { get; set; }

当表单运行时,它看起来像下面这样:

Bot with no enum choices

如果我们删除 Prompt 属性,它将显示所有类别:

All the categories being shown

为什么 Prompt 属性不能与枚举一起使用?

最佳答案

您的提示缺少 {||} pattern element .应该是:

[Prompt("Please select the appropriate category for your problem (optional). {||}")]

关于c# - 表单流枚举提示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42702024/

相关文章:

c# - EF调用存储过程出现 "must declare the scalar variable @var"错误如何解决?

javascript - 使用 DirectLine 逐步打开网络聊天窗口

c# - 多次调用 FormFlow DefineAsyncDelegate

c# - 在 formFlow 中添加验证步骤 - 检查浇头是否有货

javascript - 日历插件示例无法在 .net 上运行

c# - Azure Functions 不允许同步操作 为什么?

c# - 更新 UserPrincipal 上的名称字段

mysql - 如何使用 Node Mysql Api 在 bot 框架 v4 中存储用户对话

javascript - 我尝试了通过 Node.js 连接到 LUIS 的机器人构建器的示例。我无法连接到 LUIS

c# - 从 Form Flow 获取数据并将其输入到 api 调用中