Dynamic Update from Workflow Sample
This sample demonstrates how to dynamically update a workflow instance when it is running from inside the workflow (code-beside).
The workflow receives a purchase order request of some amount. The workflow automatically approves the purchase order when the amount is less than $1000. When the amount is greater than $1000, a purchase order approval is required. This is achieved by dynamically adding an InvokeWorkflowActivity activity from the workflow in its code-beside. Invoking another workflow enables you to encapsulate approval request logic in a workflow. However, approval logic can also be performed inline if you want.
When you build and run the sample, your output will appear similar to the following:
The SQL Server services that are installed by Windows Workflow Foundation use Microsoft SQL Server to store information. You can use Microsoft SQL Server 2005 Express, SQL Server 2000 or later versions, or SQL Server 2000 Desktop Engine (MSDE) for these tasks.
Windows Workflow Foundation Setup does not install the databasesthat these services require; however, Setup installs the SQL scripts for creating and configuring the databases for these services.
The following steps describe how to create and configure the databases that are used by services in this sample.
To create and configure the SQL Server database
Using Microsoft SQL Server 2005 Express, SQL Server 2000 or later versions, or SQL Server 2000 Desktop Engine (MSDE), create a new database named SqlPersistenceService by using the SQL query statement:
CREATE DATABASE SqlPersistenceService
In the SQL Query Analyzer workspace, select the database that you created in step 1 in the list of available databases.
On the File menu, click Open, and open the SQL script %WINDIR%\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\<language>\SqlPersistenceService_Schema.
Execute the query by clicking Execute or by pressing F5 to create the SQL Persistence Service tables.
On the File menu, click Open, and open the SQL script %WINDIR%\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\<language>\SqlPersistenceService_Logic.
Execute the query by clicking Execute or by pressing F5 to create the SQL Persistence Service stored procedures.
To build the sample
Download the sample by clicking Download Sample.
This extracts the sample project to your local hard disk.
Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.
Go to the source directory of the sample.
At the command prompt, type MSBUILD <Solution file name>.
To run the sample
- In the SDK Command Prompt window, run the .exe file in the DynamicUpdateFromWorkflow\bin\debug folder (or the DynamicUpdateFromWorkflow \bin folder for the VB version of the sample), which is located below the main folder for the sample.
© 2007 Microsoft Corporation. All rights reserved.