Using the DelayActivity Activity
Use the DelayActivity activity to cause the branch of a workflow that contains it to wait for a specified period of time. For example, you could set a time-out while waiting for a response from some external system, or you could use the DelayActivity activity to run a scheduled job at a specified time.
If a workflow becomes completely idle during the delay and the UnloadOnIdle method is set to true in your persistence service, the workflow may be unloaded from memory and then reloaded into memory when the specified delay time expires.
To specify the delay time, set the DelayActivity TimeoutDuration property to a valid TimeSpan value. Supply a literal value such as "0.01:10:30", or assign a value to a variable of type TimeSpan. The default TimeSpan value is 00:00:00.
You can also implement the DelayActivity InitializeTimeoutDuration handler, which is raised when the DelayActivity activity executes, to set the TimeoutDuration property. You can use this handler to set the TimeoutDuration property during run time for scenarios where you want to determine the time based on instance data.
For information about the DelayActivity class, see the System.Workflow.Activities namespace in the Windows Workflow Foundation Class Library reference.
For a code sample that demonstrates how to use the DelayActivity activity, see Using Delay.
For a code sample that demonstrates how to use the DelayActivity activity and the UnloadOnIdle method, see Custom Persistence Service.
Copyright © 2007 by Microsoft Corporation. All rights reserved.