共用方式為


ReceiveActivity.ParameterBindings 屬性

定義

取得在服務的型式參數清單中找到之可繫結參數的集合。

public:
 property System::Workflow::ComponentModel::WorkflowParameterBindingCollection ^ ParameterBindings { System::Workflow::ComponentModel::WorkflowParameterBindingCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Workflow.ComponentModel.WorkflowParameterBindingCollection ParameterBindings { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ParameterBindings : System.Workflow.ComponentModel.WorkflowParameterBindingCollection
Public ReadOnly Property ParameterBindings As WorkflowParameterBindingCollection

屬性值

所繫結參數的 WorkflowParameterBindingCollection

屬性

範例

下列範例將示範如何存取 ParameterBindings 屬性。 這段程式碼是來自 Conversations SDK 範例的 ShipperWorkflow.designer.cs 檔案。

ReceiveActivity receiveQuoteFromShipper1 = new ReceiveActivity();
CodeActivity shipper1ShippingQuote = new CodeActivity();
ContextToken contextToken1 = new ContextToken();
ActivityBind activityBind1 = new ActivityBind();
WorkflowParameterBinding workflowParameterBinding1 = new WorkflowParameterBinding();
TypedOperationInfo typedOperationInfo1 = new TypedOperationInfo();

receiveQuoteFromShipper1.Activities.Add(shipper1ShippingQuote);
contextToken1.Name = "Shipper1Context";
contextToken1.OwnerActivityName = "GetShippingQuotes";
receiveQuoteFromShipper1.ContextToken = contextToken1;
receiveQuoteFromShipper1.Name = "receiveQuoteFromShipper1";
activityBind1.Name = "SupplierWorkflow";
activityBind1.Path = "quoteShipper1";
workflowParameterBinding1.ParameterName = "quote";
workflowParameterBinding1.SetBinding(WorkflowParameterBinding.ValueProperty, ((ActivityBind)(activityBind1)));
receiveQuoteFromShipper1.ParameterBindings.Add(workflowParameterBinding1);
typedOperationInfo1.ContractType = typeof(IShippingQuote);
typedOperationInfo1.Name = "ShippingQuote";
receiveQuoteFromShipper1.ServiceOperationInfo = typedOperationInfo1;

備註

ParameterBindings 可用來指定服務作業參數與工作流程之公開欄位/屬性之間的繫結 (此工作流程包含 ReceiveActivity 活動)。 當用戶端叫用作業時,在接收活動的執行期間,對應的參數值會寫入繫結的工作流程屬性。

接收活動的子活動亦可使用 ParameterBindings 來讀取用戶端叫用時傳入的參數值。 子活動可使用 ParameterBindings 集合來設定父 ReceiveActivity 活動的傳回值。

服務合約的所有參數均應包含在 ParameterBindings 屬性中。 非繫結參數會導致編譯器在編譯時產生警告,且當 ReceiveActivity 將此訊息傳回給用戶端時,可能會發生例外狀況。

適用於