WorkflowPersistenceService Class

 
System_CAPS_noteNote

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

Note: This API is now obsolete.

The abstract base class from which all persistence services are derived.

Namespace:   System.Workflow.Runtime.Hosting
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)


[ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowPersistenceService : WorkflowRuntimeService

NameDescription
System_CAPS_protmethodWorkflowPersistenceService()

When implemented in a derived class, initializes a new instance of the WorkflowPersistenceService class.

NameDescription
System_CAPS_protpropertyRuntime

Gets the WorkflowRuntime for this service.(Inherited from WorkflowRuntimeService.)

System_CAPS_protpropertyState

Gets the state of the WorkflowRuntimeService.(Inherited from WorkflowRuntimeService.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_protmethodSystem_CAPS_staticGetDefaultSerializedForm(Activity)

Retrieves the serialized default form of the Activity.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_protmethodSystem_CAPS_staticGetIsBlocked(Activity)

Indicates whether the given activity is blocked.

System_CAPS_protmethodSystem_CAPS_staticGetSuspendOrTerminateInfo(Activity)

Retrieves the termination or suspend information of the given activity.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodSystem_CAPS_staticGetWorkflowStatus(Activity)

Retrieves the status of the workflow.

System_CAPS_protmethodLoadCompletedContextActivity(Guid, Activity)

When implemented in a derived class, loads the specified completed scope back into memory.

System_CAPS_protmethodLoadWorkflowInstanceState(Guid)

When implemented in a derived class, loads the specified state of the workflow instance back into memory.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnStarted()

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the WorkflowRuntime.Started event.(Inherited from WorkflowRuntimeService.)

System_CAPS_protmethodOnStopped()

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the WorkflowRuntime.Stopped event.(Inherited from WorkflowRuntimeService.)

System_CAPS_protmethodRaiseServicesExceptionNotHandledEvent(Exception, Guid)
System_CAPS_protmethodSystem_CAPS_staticRestoreFromDefaultSerializedForm(Byte[], Activity)

Restores the Activity from its serialized form.

System_CAPS_protmethodSaveCompletedContextActivity(Activity)

When implemented in a derived class, saves the specified completed scope to a data store.

System_CAPS_protmethodSaveWorkflowInstanceState(Activity, Boolean)

When implemented in a derived class, saves the workflow instance state to a data store.

System_CAPS_protmethodStart()

When overridden in a derived class, starts the service and changes the State to Starting.(Inherited from WorkflowRuntimeService.)

System_CAPS_protmethodStop()

When overridden in a derived class, stops the service and changes the State to Stopping.(Inherited from WorkflowRuntimeService.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_protmethodUnloadOnIdle(Activity)

Determines whether a workflow should be unloaded when idle.

System_CAPS_protmethodUnlockWorkflowInstanceState(Activity)

When overridden in a derived class, unlocks the workflow instance state.

System_CAPS_noteNote

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

When certain conditions occur while the workflow is running, the workflow runtime engine persists state information about the workflow instance. Persistence can occur, for example, when an atomic transaction finishes, when the workflow instance becomes idle, when the host calls WorkflowInstance.Unload on the workflow instance, or when a workflow instance is terminated or finishes. When the workflow runtime engine semantics dictate that persistence should occur, the workflow runtime engine calls methods that are supplied by a persistence service to save state information about the workflow instance. Likewise, when the workflow runtime engine needs to restore a previously persisted workflow instance, it calls methods that are supplied by the persistence service to load this state information. The workflow runtime engine handles all the semantics regarding when to perform persistence. The persistence service handles actually saving and loading the workflow state information to or from a data store.

You can create a persistence service by deriving a class from the WorkflowPersistenceService class. You can add your persistence service to the workflow runtime engine by calling AddService or by making an appropriate entry in the application configuration file. The WorkflowRuntime should only contain one persistence service. Windows Workflow Foundation provides the SqlWorkflowPersistenceService class, an out-of-box persistence service, which you can use as is or extend.

The workflow runtime engine has semantics for locking workflow state information for use in environments where persistence services that run in different processes might have access to a single data store. The WorkflowPersistenceService class provides the capability to support this functionality of the workflow runtime engine by providing a parameter to SaveWorkflowInstanceState that specifies whether the state information of a workflow instance should be unlocked in the data store, and by providing a method UnlockWorkflowInstanceState to unlock previously locked workflow state information. In a persistence service that implements locking, a call to LoadWorkflowInstanceState should lock the state information for a workflow instance.

Your persistence service should throw a PersistenceException if it fails to save state information to its data store or load state information from its data store. The workflow runtime engine expects this behavior.

A batching mechanism is provided for services that use a durable store to save workflow state information. It is important in these cases to maintain consistency between the durable store that is used by the persistence service and the internal state of the workflow runtime engine. You can add functionality defined by the IPendingWork interface to your service, and then participate in workflow transaction batching provided by the WorkflowCommitWorkBatchService by adding changes to your data store as work items to the WorkBatch. The durable store itself should implement the IEnlistmentNotification interface, so that workflow information is not persisted incorrectly in the event of a transaction rollback. For more information, see SaveCompletedContextActivity or SaveWorkflowInstanceState.

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: