This documentation is archived and is not being maintained.

ReplicatorActivity Class

Runs multiple instances of a child activity.

Namespace: System.Workflow.Activities
Assembly: System.Workflow.Activities (in system.workflow.activities.dll)

public sealed class ReplicatorActivity : CompositeActivity
public final class ReplicatorActivity extends CompositeActivity
public final class ReplicatorActivity extends CompositeActivity
Not applicable.

The ReplicatorActivity is similar to a For Each statement in code. If you are presented with a task in which you repeat the same function on many different entities, ReplicatorActivity may be a better solution than WhileActivity.

By default, a ReplicatorActivity is completed when all child instances have completed. You can override this behavior with a custom condition to use when the activity finishes. If this condition evaluates to true before all child instances have completed, then any running incomplete child instances will be canceled.

The following code example demonstrates how to create a new instance of the ReplicatorActivity class and define a handler for the Initialized event. This code example is part of the Replicator SDK Sample from the SimpleReplicatorWorkflow.Designer.cs file. For more information, see Using Replicator.

using System;
using System.Workflow.Activities;

namespace Microsoft.Samples.Workflow.SimpleReplicator
{
    public sealed partial class SimpleReplicatorWorkflow
    {
        [System.Diagnostics.DebuggerNonUserCode()]
        private void InitializeComponent()
        {
            this.CanModifyActivities = true;
            System.Workflow.ComponentModel.ActivityBind activityBind1 = new System.Workflow.ComponentModel.ActivityBind();
            this.SampleReplicatorChildActivity1 = new Microsoft.Samples.Workflow.SimpleReplicator.SampleReplicatorChildActivity();
            this.ReplicatorWork = new System.Workflow.Activities.ReplicatorActivity();
            // 
            // SampleReplicatorChildActivity1
            // 
            this.SampleReplicatorChildActivity1.InstanceData = null;
            this.SampleReplicatorChildActivity1.Name = "SampleReplicatorChildActivity1";
            activityBind1.Name = "SimpleReplicatorWorkflow";
            activityBind1.Path = "ChildData";
            // 
            // ReplicatorWork
            // 
            this.ReplicatorWork.Activities.Add(this.SampleReplicatorChildActivity1);
            this.ReplicatorWork.ExecutionType = System.Workflow.Activities.ExecutionType.Sequence;
            this.ReplicatorWork.Name = "ReplicatorWork";
            this.ReplicatorWork.ChildInitialized += new System.EventHandler<System.Workflow.Activities.ReplicatorChildEventArgs>(this.ChildInitializer);
            this.ReplicatorWork.SetBinding(System.Workflow.Activities.ReplicatorActivity.InitialChildDataProperty, ((System.Workflow.ComponentModel.ActivityBind)(activityBind1)));
            // 
            // SimpleReplicatorWorkflow
            // 
            this.Activities.Add(this.ReplicatorWork);
            this.Name = "SimpleReplicatorWorkflow";
            this.CanModifyActivities = false;

        }

        private SampleReplicatorChildActivity SampleReplicatorChildActivity1;
        private ReplicatorActivity ReplicatorWork;
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: