SqlWorkflowPersistenceService SqlWorkflowPersistenceService SqlWorkflowPersistenceService SqlWorkflowPersistenceService Class

Definition

Warning

This API is now obsolete.

Represents a persistence service that uses a SQL database to store workflow state information.

public ref class SqlWorkflowPersistenceService : System::Workflow::Runtime::Hosting::WorkflowPersistenceService, System::Workflow::Runtime::IPendingWork
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class SqlWorkflowPersistenceService : System.Workflow.Runtime.Hosting.WorkflowPersistenceService, System.Workflow.Runtime.IPendingWork
type SqlWorkflowPersistenceService = class
    inherit WorkflowPersistenceService
    interface IPendingWork
Public Class SqlWorkflowPersistenceService
Inherits WorkflowPersistenceService
Implements IPendingWork
Inheritance
Attributes
Implements

Remarks

Note

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

The SqlWorkflowPersistenceService class represents a fully-functional persistence service. You can use this service out-of-box to persist and retrieve workflow state information about a workflow instance when requested to by the workflow runtime engine.

The SqlWorkflowPersistenceService participates in the workflow transaction batching functionality provided by the WorkflowCommitWorkBatchService. That is, it adds objects that represent pending writes to the SQL database to the WorkBatch and implements the IPendingWork interface.

The SqlWorkflowPersistenceService supports locking of workflow instances. This feature is used when several workflow runtimes share the same database. A column in the SQL database table is used to mark a workflow instance as locked whenever it is being used by a workflow runtime. The SqlWorkflowPersistenceService does not load a workflow instance that is marked as "in use" by another runtime. Typically these locks are released when the workflow instance is persisted, for example, on idle, completion, or termination. The locks can also be released automatically after a period of inactivity. This period of inactivity can be set using the constructor of the SqlWorkflowPersistenceService class. It can also be set through the configuration file.

For more information about persistence services in general, see the WorkflowPersistenceService class.

Workflow instances can contain timers, for example, if they have a DelayActivity. For workflows that contain timers, the SqlWorkflowPersistenceService records the time when the workflow's next timer expires. The SqlWorkflowPersistenceService periodically polls the database, looking for workflows whose timers have expired. The frequency of the polling interval can be set using the SqlWorkflowPersistenceService constructor or using a configuration file.

Note

When using both the SqlTrackingService and the SqlWorkflowPersistenceService in a workflow application, it is recommended to use a single database for both persistence and tracking.

Constructors

SqlWorkflowPersistenceService(NameValueCollection) SqlWorkflowPersistenceService(NameValueCollection) SqlWorkflowPersistenceService(NameValueCollection) SqlWorkflowPersistenceService(NameValueCollection)

Initializes a new instance of the SqlWorkflowPersistenceService class by using the specified parameters.

SqlWorkflowPersistenceService(String) SqlWorkflowPersistenceService(String) SqlWorkflowPersistenceService(String) SqlWorkflowPersistenceService(String)

Initializes a new instance of the SqlWorkflowPersistenceService class by using the database connection string.

SqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan) SqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan) SqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan) SqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan)

Initializes a new instance of the SqlWorkflowPersistenceService class using a database connection string and other parameters.

Properties

EnableRetries EnableRetries EnableRetries EnableRetries

Gets and sets a value that specifies whether the SqlWorkflowPersistenceService retries committing a work batch.

LoadingInterval LoadingInterval LoadingInterval LoadingInterval

Gets the length of the loading interval.

Runtime Runtime Runtime Runtime

Gets the WorkflowRuntime for this service.

(Inherited from WorkflowRuntimeService)
ServiceInstanceId ServiceInstanceId ServiceInstanceId ServiceInstanceId

Gets the service instance identifier.

State State State State

Gets the state of the WorkflowRuntimeService.

(Inherited from WorkflowRuntimeService)

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAllWorkflows() GetAllWorkflows() GetAllWorkflows() GetAllWorkflows()

Retrieves instance descriptions of all persisted workflows.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
LoadCompletedContextActivity(Guid, Activity) LoadCompletedContextActivity(Guid, Activity) LoadCompletedContextActivity(Guid, Activity) LoadCompletedContextActivity(Guid, Activity)

Retrieves the specified completed scope from the database.

LoadExpiredTimerWorkflowIds() LoadExpiredTimerWorkflowIds() LoadExpiredTimerWorkflowIds() LoadExpiredTimerWorkflowIds()

Retrieves a list of ids for workflows with expired timers.

LoadWorkflowInstanceState(Guid) LoadWorkflowInstanceState(Guid) LoadWorkflowInstanceState(Guid) LoadWorkflowInstanceState(Guid)

Retrieves the specified workflow instance state from the database.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnStarted() OnStarted() OnStarted() OnStarted()

Starts a new timer and recovers running workflow instances.

OnStopped() OnStopped() OnStopped() OnStopped()

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Stopped event.

(Inherited from WorkflowRuntimeService)
RaiseServicesExceptionNotHandledEvent(Exception, Guid) RaiseServicesExceptionNotHandledEvent(Exception, Guid) RaiseServicesExceptionNotHandledEvent(Exception, Guid) RaiseServicesExceptionNotHandledEvent(Exception, Guid)

Raises the ServicesExceptionNotHandled event.

(Inherited from WorkflowRuntimeService)
SaveCompletedContextActivity(Activity) SaveCompletedContextActivity(Activity) SaveCompletedContextActivity(Activity) SaveCompletedContextActivity(Activity)

Saves the state of the specified completed scope.

SaveWorkflowInstanceState(Activity, Boolean) SaveWorkflowInstanceState(Activity, Boolean) SaveWorkflowInstanceState(Activity, Boolean) SaveWorkflowInstanceState(Activity, Boolean)

Saves the specified workflow instance state.

Start() Start() Start() Start()

Starts the SqlWorkflowPersistenceService.

Stop() Stop() Stop() Stop()

Stops the service and the timer.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
UnloadOnIdle(Activity) UnloadOnIdle(Activity) UnloadOnIdle(Activity) UnloadOnIdle(Activity)

Returns a value that indicates whether the workflow is unloaded when it is in an idle state.

UnlockWorkflowInstanceState(Activity) UnlockWorkflowInstanceState(Activity) UnlockWorkflowInstanceState(Activity) UnlockWorkflowInstanceState(Activity)

Unlocks access to the specified workflow instance state.

Explicit Interface Implementations

IPendingWork.Commit(Transaction, ICollection) IPendingWork.Commit(Transaction, ICollection) IPendingWork.Commit(Transaction, ICollection) IPendingWork.Commit(Transaction, ICollection)

Writes an ICollection of serialized state objects to the database.

IPendingWork.Complete(Boolean, ICollection) IPendingWork.Complete(Boolean, ICollection) IPendingWork.Complete(Boolean, ICollection) IPendingWork.Complete(Boolean, ICollection)

Completes the work batch and releases any resources.

IPendingWork.MustCommit(ICollection) IPendingWork.MustCommit(ICollection) IPendingWork.MustCommit(ICollection) IPendingWork.MustCommit(ICollection)

Returns a value that indicates whether the collection of serialized state objects should be written to the database.

Applies to