Partilhar via


Throttled Parallel ForEach

This topic applies to Windows Workflow Foundation 4 (WF4).

The ThrottleParallelForEach activity is similar to the ParallelForEach activity with the one exception that it allows setting a concurrency factor to restrict the number of simultaneous branches to execute. The ThrottleParallelForEach activity derives from NativeActivity, because it needs to schedule other activities (the child activities) and this is only accessible through the NativeActivityContext class.

Projects

ProjectName

Description

Main Files

ThrottledParallelForEach

Contains ThrottledParallelForEach activity and its designer.

ThrottledParallelForEach.cs

The ThrottledParallelForEach activity definition.

CodeTestClient

Sample client application that configures and runs a workflow with a ThrottledParallelForEach using imperative code.

Program.cs

Defines and runs an instance of the sample workflow.

To use this sample

  1. Using Visual Studio 2010, open the ThrottledParallelForEach.sln file.

  2. To build the solution, press CTRL+SHIFT+B.

  3. To run the solution, press F5.

Ee620808.Important(en-us,VS.100).gif Note:
The samples may already be installed on your machine. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

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.

<InstallDrive>:\WF_WCF_Samples\WF\Scenario\ActivityLibrary\ThrottledParallelForEach