Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WorkflowHostingEndpoint::OnGetInstanceId Method (array<Object^>^, OperationContext^)

.NET Framework (current version)
 

Override to return the instance ID for the workflow instance being created.

Namespace:   System.ServiceModel.Activities
Assembly:  System.ServiceModel.Activities (in System.ServiceModel.Activities.dll)

public protected:
virtual Guid OnGetInstanceId(
	array<Object^>^ inputs,
	OperationContext^ operationContext
)

Parameters

inputs
Type: array<System::Object^>^

The inputs to the service operation.

operationContext
Type: System.ServiceModel::OperationContext^

The operation context of the service operation.

Return Value

Type: System::Guid

The instance ID for the newly created workflow instance.

Return null to indicate that an instance ID should be automatically generated.

The following example shows how to implement the OnGetInstanceId method.

protected override Guid OnGetInstanceId(object[] inputs, OperationContext operationContext)
{
    //Create was called by client
    if (operationContext.IncomingMessageHeaders.Action.EndsWith("Create"))
    {
        return Guid.Empty;
    }
    //CreateWithInstanceId was called by client
    else if (operationContext.IncomingMessageHeaders.Action.EndsWith("CreateWithInstanceId"))
    {
        return (Guid)inputs[1];
    }
    else
    {
        throw new InvalidOperationException("Invalid Action: " + operationContext.IncomingMessageHeaders.Action);
    }
}

.NET Framework
Available since 4.0
Return to top
Show:
© 2017 Microsoft