Bewerken

Share via


SqlWorkflowPersistenceService Class

Definition

Caution

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

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
public 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
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
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)

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

SqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan)

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

SqlWorkflowPersistenceService(String)

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

Properties

EnableRetries

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

LoadingInterval

Gets the length of the loading interval.

Runtime

Gets the WorkflowRuntime for this service.

(Inherited from WorkflowRuntimeService)
ServiceInstanceId

Gets the service instance identifier.

State

Gets the state of the WorkflowRuntimeService.

(Inherited from WorkflowRuntimeService)

Methods

Equals(Object)

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

(Inherited from Object)
GetAllWorkflows()

Retrieves instance descriptions of all persisted workflows.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
LoadCompletedContextActivity(Guid, Activity)

Retrieves the specified completed scope from the database.

LoadExpiredTimerWorkflowIds()

Retrieves a list of ids for workflows with expired timers.

LoadWorkflowInstanceState(Guid)

Retrieves the specified workflow instance state from the database.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnStarted()

Starts a new timer and recovers running workflow instances.

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)

Raises the ServicesExceptionNotHandled event.

(Inherited from WorkflowRuntimeService)
SaveCompletedContextActivity(Activity)

Saves the state of the specified completed scope.

SaveWorkflowInstanceState(Activity, Boolean)

Saves the specified workflow instance state.

Start()

Starts the SqlWorkflowPersistenceService.

Stop()

Stops the service and the timer.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
UnloadOnIdle(Activity)

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

UnlockWorkflowInstanceState(Activity)

Unlocks access to the specified workflow instance state.

Explicit Interface Implementations

IPendingWork.Commit(Transaction, ICollection)

Writes an ICollection of serialized state objects to the database.

IPendingWork.Complete(Boolean, ICollection)

Completes the work batch and releases any resources.

IPendingWork.MustCommit(ICollection)

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

Applies to