Edit

Share via


ReceiveActivity.CanCreateInstance Property

Definition

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

C#
[System.ComponentModel.Browsable(true)]
public bool CanCreateInstance { get; set; }

Property Value

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

Attributes

Examples

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.

C#
ReceiveActivity receiveRequestShippingQuote;
CodeActivity doAcceptQuoteRequest;

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

receiveRequestShippingQuote.Activities.Add(doAcceptQuoteRequest);
receiveRequestShippingQuote.CanCreateInstance = true;

Remarks

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.

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1