Search

Search:

Namespace:

Search Result
.

Use the CloseActivity function to indicate that an event driven activity is finished executing by setting its state to Closed. Alternatively you can cancel the activity by calling the CancelActivity function.

.

Most often used when creating asynchronously executing, ie long running activities. In the Execute function you return ActivityExecutionStatus.Executing indicating that the Activity is still executing. When the work in the activity is finished the ActivityExecutionContext.CloseActivity() function is called informing the WorkflowRuntime that the Activity is done.

.
        executionContext.CloseActivity()
.
        context.CloseActivity()
.

But the previous examples where still pretty simple, although mocking the ActivityExecutionContext has always been considered impossible, so lets try something more complicated in the shape of an asynchronous activity. Basically an asynchronous activity is an activity that returns ActivityExecutionStatus.Executing from the Execute method indicating to the workflow runtime that it isn't done yet. The activity uses ActivityExecutionContext at a later point in time to indicate that it is done by calling the CloseActivity function.

.
        executionContext.CloseActivity();
.
        executionContext.CloseActivity();