SqlPersistenceProviderFactory.CreateProvider(Guid) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new LockingPersistenceProvider instance that uses a SQL database as its persistence store.
public:
override System::ServiceModel::Persistence::PersistenceProvider ^ CreateProvider(Guid id);
public override System.ServiceModel.Persistence.PersistenceProvider CreateProvider (Guid id);
override this.CreateProvider : Guid -> System.ServiceModel.Persistence.PersistenceProvider
Public Overrides Function CreateProvider (id As Guid) As PersistenceProvider
Parameters
- id
- Guid
The unique identifier of the persistence provider being created.
Returns
A newly-created PersistenceProvider.
Examples
The following code example shows how to execute the CreateProvider
method. Note that the resulting provider is accessed as a LockingPersistenceProvider instance.
SqlPersistenceProviderFactory factory = new SqlPersistenceProviderFactory(
DataBaseConstants.ConnectionString,
false,
TimeSpan.FromSeconds(60));
LockingPersistenceProvider provider = (LockingPersistenceProvider)factory.CreateProvider(Guid.NewGuid());
Remarks
The initialized persistence provider uses the current parameters of the creating factory (ConnectionString, LockTimeout, and SerializeAsText), even if the factory's parameters are changed after the persistence provider is created.