Using AsyncOperationContext in an Activity Sample

This sample demonstrates how to develop a custom CodeActivity that uses AsyncCodeActivityContext to perform work asynchronously outside of the workflow.

Sample Details

The sample activity uses the BeginWrite and EndWrite methods on the FileStream class to asynchronously write data to a file. The pattern introduced here can be adapted for use with other asynchronous methods. While the asynchronous operation is executing, other activities in the workflow can execute, but the workflow cannot be persisted.

To set up, build, and run the sample

  1. Open the Async.sln sample solution in Visual Studio 2010.

  2. Build and run the solution.


The samples may already be installed on your machine. Check for the following (default) directory before continuing.


If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.


See Also