Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Technology Samples
Hosting
 Custom Persistence Service Sample

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Custom Persistence Service Sample

Download sample

This sample demonstrates how to write a custom persistence service that is used by the workflow runtime to save workflow instance state to a file when unloading a workflow from memory.

In the sample, the workflow waits five seconds during a DelayActivity activity. Because workflowRuntime.UnloadOnIdle is set to true, the runtime engine serializes the instance state by using the configured state persistence service. In this case, the runtime is configured to use the custom file persistence service to persist instance state as a file. The configuration is done by the AddService method.

A custom persistence service has to derive from the WorkflowPersistenceService abstract class and provide custom implementation for its methods. The purpose of letting an application provide the runtime with its specific persistence service is to enable scenarios beyond the default SqlWorkflowPersistenceService that persists to a SQL Server database.

The following figure shows the expected output of this sample.

Customer persistence sample output

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the CustomPersistenceService\bin\debug folder (or the CustomPersistenceService\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also


© 2007 Microsoft Corporation. All rights reserved.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker