ReceiveActivity.CanCreateInstance Property


Gets or sets whether the operation causes a new workflow service instance to be created.

Namespace:   System.Workflow.Activities
Assembly:  System.WorkflowServices (in System.WorkflowServices.dll)

public bool CanCreateInstance { get; set; }

Property Value

Type: System.Boolean

true if a new workflow instance is created; otherwise, false.

A ReceiveActivity activity that has CanCreateInstance set to true represents a service operation that, when invoked by a service client without being part of a conversation, causes a new instance of the service workflow to be created.

Service workflows that do not have a ReceiveActivity activity with CanCreateInstance set to true cannot be instantiated by a client using a service operation invocation. Such workflows can be created using the CreateWorkflow method of the associated WorkflowRuntime object.

The default value for this property is false.

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

ReceiveActivity receiveRequestShippingQuote;
CodeActivity doAcceptQuoteRequest;

doAcceptQuoteRequest = new System.Workflow.Activities.CodeActivity();
receiveRequestShippingQuote = new System.Workflow.Activities.ReceiveActivity();

receiveRequestShippingQuote.CanCreateInstance = true;

.NET Framework
Available since 3.5
Return to top