Completed Windows Workflow Foundation Runtime Hosting Tutorial

Download sample

Note

The project files that are listed here contain the complete source code for Tutorial: Host the WF Runtime.

A workflow must have some type of hosting application in order to execute. At the most basic level, a Windows Workflow Foundation-based host application uses the WorkflowRuntime to create and start a workflow. During the execution of the workflow, the host application may also communicate with the workflow for the exchange of data. This tutorial explains how to implement this basic scenario and discusses advanced hosting concepts that are related to Windows Workflow Foundation runtime services.

Tutorial Overview

Task 1: Create a Workflow and Pass Parameters, which is located in Exercise 2: Run a Workflow, demonstrates the procedure to pass parameters to a workflow as it begins execution. By passing a dictionary-based collection of values, the runtime engine resolves the keys in that collection to the properties of the workflow and set those properties based on the corresponding value in the collection.

In Task 1: Listen For and Process Events of Exercise 3: Work with Runtime Events, the tutorial demonstrates how to create event handlers for the events that are raised by the runtime engine and also the events raised during specific workflow events. In the next task, Task 2: Suspend, Terminate, and Resume Workflows, the tutorial shows how to control the execution of the workflow by suspending or terminating the workflow. If the workflow is suspended, the host application also has the option of resuming it later.

Exercise 4: Use Runtime Services covers various tasks associated with some of the runtime services built into Windows Workflow Foundation. In Task 1: Configure Runtime Services Using Code and Task 2: Configure Runtime Services using App.Config, the host application adds runtime services and sets service-specific properties, using source code or an application configuration file, respectively. In Task 3: Use the Windows Workflow Persistence Service, the SqlWorkflowPersistenceService service is used to provide workflow persistence to a SQL database. In Task 4: Use the Windows Workflow Tracking Service and Task 5: Create a Tracking Profile, the host application configures the SqlTrackingService service to enable the tracking of workflow events to a SQL tracking database.

See Also

Other Resources

SQL Data Maintenance Sample
Hosting

Copyright © 2007 by Microsoft Corporation. All rights reserved.
Last Published: 2010-03-04