InstanceStore.Execute Method (InstanceHandle, InstancePersistenceCommand, TimeSpan)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Executes a persistence command synchronously. Examples of persistence commands are: LoadWorkflowCommand and SaveWorkflowCommand.

Namespace:   System.Runtime.DurableInstancing
Assembly:  System.Runtime.DurableInstancing (in System.Runtime.DurableInstancing.dll)

public InstanceView Execute(
	InstanceHandle handle,
	InstancePersistenceCommand command,
	TimeSpan timeout


Type: System.Runtime.DurableInstancing.InstanceHandle

An instance handle.

Type: System.Runtime.DurableInstancing.InstancePersistenceCommand

The command to be executed.

Type: System.TimeSpan

The timeout value for the operation.

Return Value

Type: System.Runtime.DurableInstancing.InstanceView

An InstanceView object representing the known state of the instance after the successful completion of the command. If Execute was called under a transaction, this state may include uncommitted data. Once the transaction is committed successfully, the data in the InstanceView object can be considered committed

A host calls the Execute method to execute a persistence command against an instance handle, which the host obtains by invoking the CreateInstanceHandle method. The instance handle may be bound to entities that represent the context and subject of the command, such as an instance, instance owner, or instance lock. Only one command may be issued against an instance handle at a time.


If this method is executed with a CreateWorkflowOwnerCommand, it will create an InstanceOwner and bind it to the instance. This means that no other process will be able to access that workflow; if the process ends, the workflow cannot be recovered or executed. If such a workflow is executed again, a InstanceLockedException will be thrown.

If CreateWorkflowOwnerCommand is not used, the instance store will create a temporary InstanceOwner that will be deleted at the end of the process. However, if the process ends before the workflow’s final persistence point, this exception will be thrown, unless the period of time specified in the HostLockRenewalPeriod parameter has expired.

.NET Framework
Available since 4.0
Return to top