ReceiveActivity.ParameterBindings 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取服务的形参表中可绑定参数的集合。
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
文件中的 ShipperWorkflow.designer.cs
SDK 示例改写。
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 将此消息返回到客户端时,可能会发生异常。