共用方式為


FormBuilderJson 類別

定義

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

public sealed class FormBuilderJson : Microsoft.Bot.Builder.FormFlow.FormBuilderBase<Newtonsoft.Json.Linq.JObject>
type FormBuilderJson = class
    inherit FormBuilderBase<JObject>
Public NotInheritable Class FormBuilderJson
Inherits FormBuilderBase(Of JObject)
繼承
FormBuilderBase<Newtonsoft.Json.Linq.JObject>
FormBuilderJson

備註

透過 JSON 架構 定義表單,其中包含對應至 C# 所提供屬性的選擇性其他批註。

%FormFlow 會使用一些標準 JSON 架構 關鍵詞,包括:

  • type -- 定義欄位類型。 * enum -- 定義可能的域值。 * minimum -- 定義允許的最小值,如 中所述 NumericAttribute。 * maximum -- 定義允許的最大值,如 中所述 NumericAttribute。 * required -- 定義需要哪些欄位。 * pattern -- 字串欄位將用來驗證輸入的模式,如 中所述 PatternAttribute

    範本和提示會使用與和 PromptAttribute相同的詞彙TemplateAttribute。 屬性名稱相同,且值與基礎 C# 列舉中的值相同。 例如,若要定義範本來覆寫 NotUnderstood 範本,並指定 TemplateBaseAttribute.ChoiceStyle,您會將它放在架構中: \ “Templates”:{ “NotUnder read”: { Patterns: [“I't get it”], “ChoiceStyle”:“Auto”}} }

    %Extensions 定義於架構 * 的根目錄 * OnCompletion: script -- C# 腳本,其中包含自變數 (IDialogContext 內容、JObject 狀態) 完成表單。 * References: [assemblyReference, ...] -- 定義要包含在文稿中的參考。 路徑應該是絕對路徑,或相對於目前目錄。 預設會包含 Microsoft.Bot.Builder.dll。 * Imports: [import, ...] -- 定義要包含在文稿中使用using的匯入。 根據預設,這些命名空間包括:Microsoft.Bot.Builder、Microsoft.Bot.Builder.Dialogs、Microsoft.Bot.Builder.FormFlow、Microsoft.Bot.Builder.FormFlow.Advanced、System.Collections.Generic、System.Linq

    %Extensions 定義於架構的根目錄或做為 「type」 屬性的對等。 * Templates:{TemplateUsage: { Patterns:[string, ...], &lt;args&gt; }, ...} -- 定義範本。 * Prompt: { Patterns:[string, ...] &lt;args&gt;} -- 定義提示。

    在屬性描述中找到的 %Extensions,與 JSON 架構的「類型」屬性對等互連。 * DateTime:bool -- 將欄位標示為 DateTime 欄位。 * Describe:string -- 欄位的描述,如 中所述 DescribeAttribute。 * Terms:[string,...] -- 比對域值的正則表達式,如 中所述 TermsAttribute。 * MaxPhrase:int -- 這會透過 執行 GenerateTerms(String, Int32) 您的條款來加以擴充。 * Values:{ string: {Describe:string, Terms:[string, ...], MaxPhrase}, ...} -- 字串必須位於 「enum」 類型中,這可讓您覆寫自動產生的描述和詞彙。 如果指定 MaxPhrase,則會透過 傳遞 GenerateTerms(String, Int32)字詞。 * Active:script -- 具有自變數的 C# 腳稿 (JObject 狀態) -bool>,以測試字段/訊息/確認是否為作用中。 * Validate:script -- 具有自變數的 C# 腳本 (JObject 狀態、物件值) -ValidateResult> 來驗證域值。 * Define:script -- 具有自變數的 C# 腳稿 (JObject 狀態、Field<JObject> 字段) ,用於動態定義欄位。 * Before:[confirm|message, ...] -- 包含欄位之前的訊息或確認。 * After:[confirm|message, ...] -- 包含欄位之後的訊息或確認。 * {Confirm:script|[string, ...], ...templateArgs} -- 使用 Before/After 透過具有自變數的 C# 腳本來定義確認, (JObject 狀態) 或透過一組模式,以選擇性範本自變數隨機選取。 * {Message:script|[string, ...] ...templateArgs} -- 使用 Before/After 透過具有自變數的 C# 腳本定義訊息, (JObject 狀態) 或透過一組模式,以選擇性範本自變數隨機選取。 * Dependencies:[string, ...]-- Fields that this field, message or confirm depends on.</p><p>Scripts can be any C# code you would find in a method body. You can add references through "References" and using through "Imports". Special global variables include: *選擇-- internal dispatch for script to execute. *狀態-- JObject form state bound for all scripts. *ifield -- <xref data-throw-if-not-resolved="true" uid="Microsoft.Bot.Builder.FormFlow.Advanced.IField1“> 允許針對 %Message/Confirm 提示產生器以外的所有腳本,對目前字段進行推論。 * value -- 要驗證驗證的物件值。 * field -- Field<T> 表示允許在Define中動態更新欄位。 * context -- IDialogContext 允許在 OnCompletion 中張貼結果的內容。

    透過這個類別定義的 %欄位,能夠像任何其他欄位一樣,以程式設計方式擴充或覆寫定義。 也可用相同方式進行當地語系化。

建構函式

FormBuilderJson(JObject)

建立 JSON 表體產生器。

欄位

_form

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)

屬性

Configuration

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Schema

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

方法

AddRemainingFields(IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

Build(Assembly, String)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

Confirm(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Confirm(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Confirm(String, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Field(IField<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Field(String, ActiveDelegate<JObject>, ValidateAsyncDelegate<JObject>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

Field(String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Field(String, PromptAttribute, ActiveDelegate<JObject>, ValidateAsyncDelegate<JObject>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

Field(String, PromptAttribute, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Field(String, String, ActiveDelegate<JObject>, ValidateAsyncDelegate<JObject>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

Field(String, String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
HasField(String)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Message(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Message(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Message(String, ActiveDelegate<T>, IEnumerable<String>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
OnCompletion(OnCompletionAsyncDelegate<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)
Prompter(PromptAsyncDelegate<T>)

透過 JSON 架構或程式設計方式指定訊息、欄位和確認,以建置表單。

(繼承來源 FormBuilderBase<T>)

適用於