Поделиться через


Workflow Service Utilities

Download sample

This project contains all the utilities that the other samples use in this section to manipulate the context and create the listener infrastructure for local services. This project is not a sample; it is used by the Duplex Workflow Service Sample and Calculator Client Sample samples as a utility project.

Note

This sample requires that .NET Framework version 3.5 is installed in order to build and run. Visual Studio 2008 is required to open the project and solution files.

This project provides the following two helper classes: LocalWorkflowServiceHost and ContextManager.

LocalWorkflowServiceHost

The LocalWorkflowServiceHost helper class enables a local host application to interact with a single WorkflowService instance. All interaction is accomplished using messaging through service contracts. The ServiceHost type creates both a ServiceHost for a singleton service implementation the localhost provides and a WorkflowServiceHost for the workflow service implementation. It automatically creates local listener endpoints for the local service and workflow service to enable communication. The workflow can communicate with the localhost endpoints using a client endpoint named HostEndpoint. The local host can use CreateLocalChannel<T> to create channels to the workflow service. This class also manages the context for a single workflow instance so that an application can be shut down and restarted, recovering the previous workflow instance. This presumes the workflow instance is being durably stored.

ContextManager

The ContextManager class provides all the helper functions that are required to manipulate the context. It provides functions to extract the context from the channel, apply context to a channel, and apply an endpoint address to the send activity.

To take advantage of these helper classes, you can use this sample in your own solutions.

© 2007 Microsoft Corporation. All rights reserved.