Επεξεργασία

Κοινή χρήση μέσω


ReceiveActivity.ParameterBindings Property

Definition

Gets the collection of bindable parameters as found in the service's formal parameter list.

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

Property Value

The WorkflowParameterBindingCollection of parameters to bind to.

Attributes

Examples

The following example shows how to access the ParameterBindings property. This code was adapted from the Conversations SDK sample, from the ShipperWorkflow.designer.cs file.

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;

Remarks

ParameterBindings can be used to specify a binding between the service operation parameters and public field/properties of the workflow that contain the ReceiveActivity activity. When a client invokes the operation, the corresponding parameter values are written to bound workflow properties during the receive activity's execution.

ParameterBindings can also be used by the receive activity's child activities to read the parameter values passed in by client invocation. Child activities can use the ParameterBindings collection to set the return value of the parent ReceiveActivity activity.

All parameters of the service contract should be included in the ParameterBindings property. Unbound parameters cause compiler warnings upon compilation and an exception can occur when the ReceiveActivity returns this message back to the client.

Applies to