表单流枚举提示错误

时间:2017-03-09 17:42:00

标签: 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

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

All the categories being shown

为什么“提示”属性不能与枚举一起使用?

1 个答案:

答案 0 :(得分:3)

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

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