InstanceStore.Execute Method


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

 System::Runtime::DurableInstancing::InstanceView ^ Execute(System::Runtime::DurableInstancing::InstanceHandle ^ handle, System::Runtime::DurableInstancing::InstancePersistenceCommand ^ command, TimeSpan timeout);
public System.Runtime.DurableInstancing.InstanceView Execute (System.Runtime.DurableInstancing.InstanceHandle handle, System.Runtime.DurableInstancing.InstancePersistenceCommand command, TimeSpan timeout);
member this.Execute : System.Runtime.DurableInstancing.InstanceHandle * System.Runtime.DurableInstancing.InstancePersistenceCommand * TimeSpan -> System.Runtime.DurableInstancing.InstanceView
Public Function Execute (handle As InstanceHandle, command As InstancePersistenceCommand, timeout As TimeSpan) As InstanceView



An instance handle.


The command to be executed.


The timeout value for the operation.



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.

Applies to