This documentation is archived and is not being maintained.

SqlPersistenceProviderFactory Class

An out-of-box PersistenceProviderFactory implementation used to create a LockingPersistenceProvider instance that uses a SQL database to store persisted service state data.

Namespace:  System.ServiceModel.Persistence
Assembly:  System.WorkflowServices (in System.WorkflowServices.dll)

public class SqlPersistenceProviderFactory : PersistenceProviderFactory

The SqlPersistenceProviderFactory class represents a factory class for a fully functional durable service persistence provider. You can use this provider out-of-box to persist and retrieve state information about a durable WCF service.

In addition to persistence, the provider created by the SqlPersistenceProviderFactory class implements locking of service state data records by inheriting from the abstract LockingPersistenceProvider class. Methods that interact with persisted data (such Create or Update) have an optional parameter (lockInstance) that defines whether or not locks on the data in question will be released or maintained.


PersistenceException exceptions thrown by SqlPersistenceProviderFactory do not have their exception details hidden by default; in order to protect against security vulnerabilities, these details can be hidden by setting IncludeExceptionDetailInFaults to false.


The SQL Persistence Provider stores and retrieves data from a SQL Server database. The host must create a secure SQL Server environment to protect against attackers gaining read/write access to the instance state either in the database or on the wire between the application and the database.

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5