Export (0) Print
Expand All

SqlWorkflowPersistenceService Class

Note: This API is now obsolete.

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

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 class SqlWorkflowPersistenceService : WorkflowPersistenceService, 
	IPendingWork

The SqlWorkflowPersistenceService type exposes the following members.

  NameDescription
Public methodSqlWorkflowPersistenceService(NameValueCollection)Initializes a new instance of the SqlWorkflowPersistenceService class by using the specified parameters.
Public methodSqlWorkflowPersistenceService(String)Initializes a new instance of the SqlWorkflowPersistenceService class by using the database connection string.
Public methodSqlWorkflowPersistenceService(String, Boolean, TimeSpan, TimeSpan)Initializes a new instance of the SqlWorkflowPersistenceService class using a database connection string and other parameters.
Top

  NameDescription
Public propertyEnableRetriesGets and sets a value that specifies whether the SqlWorkflowPersistenceService retries committing a work batch.
Public propertyLoadingIntervalGets the length of the loading interval.
Protected propertyRuntimeGets the WorkflowRuntime for this service. (Inherited from WorkflowRuntimeService.)
Public propertyServiceInstanceIdGets the service instance identifier.
Protected propertyStateGets the state of the WorkflowRuntimeService. (Inherited from WorkflowRuntimeService.)
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAllWorkflowsRetrieves instance descriptions of all persisted workflows.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodLoadCompletedContextActivityRetrieves the specified completed scope from the database. (Overrides WorkflowPersistenceService.LoadCompletedContextActivity(Guid, Activity).)
Public methodLoadExpiredTimerWorkflowIdsRetrieves a list of ids for workflows with expired timers.
Protected methodLoadWorkflowInstanceStateRetrieves the specified workflow instance state from the database. (Overrides WorkflowPersistenceService.LoadWorkflowInstanceState(Guid).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnStartedStarts a new timer and recovers running workflow instances. (Overrides WorkflowRuntimeService.OnStarted().)
Protected methodOnStoppedWhen 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.)
Protected methodRaiseServicesExceptionNotHandledEventRaises the WorkflowRuntime.ServicesExceptionNotHandled event. (Inherited from WorkflowRuntimeService.)
Protected methodSaveCompletedContextActivitySaves the state of the specified completed scope. (Overrides WorkflowPersistenceService.SaveCompletedContextActivity(Activity).)
Protected methodSaveWorkflowInstanceStateSaves the specified workflow instance state. (Overrides WorkflowPersistenceService.SaveWorkflowInstanceState(Activity, Boolean).)
Protected methodStartStarts the SqlWorkflowPersistenceService. (Overrides WorkflowRuntimeService.Start().)
Protected methodStopStops the service and the timer. (Overrides WorkflowRuntimeService.Stop().)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodUnloadOnIdleReturns a value that indicates whether the workflow is unloaded when it is in an idle state. (Overrides WorkflowPersistenceService.UnloadOnIdle(Activity).)
Protected methodUnlockWorkflowInstanceStateUnlocks access to the specified workflow instance state. (Overrides WorkflowPersistenceService.UnlockWorkflowInstanceState(Activity).)
Top

  NameDescription
Explicit interface implemetationPrivate methodIPendingWork.CommitWrites an ICollection of serialized state objects to the database.
Explicit interface implemetationPrivate methodIPendingWork.CompleteCompletes the work batch and releases any resources.
Explicit interface implemetationPrivate methodIPendingWork.MustCommitReturns a value that indicates whether the collection of serialized state objects should be written to the database.
Top

NoteNote

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.

NoteNote

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.

.NET Framework

Supported in: 4, 3.5, 3.0
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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