Returns a cloned activity tree to which changes can be made and then applied to the running workflow instance.
Assembly: System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)
The following example demonstrates adding activities to the TransientWorkflow property. This example is from the Ordering State Machine SDK sample. For more information, see Ordering State Machine Sample.
// Create a new instance of the WorkflowChanges class for managing // the in-memory changes to the workflow WorkflowChanges changes = new WorkflowChanges(root); // Create a new State activity to the workflow StateActivity orderOnHoldState = new StateActivity(); orderOnHoldState.Name = "OrderOnHoldState"; // Add a new EventDriven activity to the State EventDrivenActivity eventDrivenDelay = new EventDrivenActivity(); eventDrivenDelay.Name = "DelayOrderEvent"; orderOnHoldState.Activities.Add(eventDrivenDelay); // Add a new Delay, initialized to 5 seconds DelayActivity delayOrder = new DelayActivity(); delayOrder.Name = "delayOrder"; delayOrder.TimeoutDuration = new TimeSpan(0, 0, 5); eventDrivenDelay.Activities.Add(delayOrder); // Add a new SetState to the OrderOpenState SetStateActivity setStateOrderOpen = new SetStateActivity(); setStateOrderOpen.TargetStateName = "OrderOpenState"; eventDrivenDelay.Activities.Add(setStateOrderOpen); // Add the OnHoldState to the workflow changes.TransientWorkflow.Activities.Add(orderOnHoldState);
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.