You are creating a Windows Workflow Foundation custom activity by using Microsoft .NET Framework 3.5.
The custom activity has the following characteristics:
It is derived from the System.Workflow.ComponentModel.CompositeActivity class.
It manages a single child activity.
It subscribes to the Closed event of the child activity.
You plan to implement the cancellation logic for the custom activity.
You need to ensure that during the cancellation process, the custom activity cancels the execution of the child activity.
Which code segment should you use?
A.
protected override ActivityExecutionStatus Cancel( ActivityExecutionContext context){ context.CancelActivity(EnabledActivities[0]); return ActivityExecutionStatus.Closed;}
B.
protected override ActivityExecutionStatus Cancel( ActivityExecutionContext context){ context.ExecutionContextManager.CompleteExecutionContext( context); return ActivityExecutionStatus.Closed; }
C.
protected override ActivityExecutionStatus Cancel( ActivityExecutionContext context) { ActivityExecutionStatus childStatus = EnabledActivities[0].ExecutionStatus; if (childStatus == ActivityExecutionStatus.Executing) context.CancelActivity(EnabledActivities[0]); else if(childStatus == ActivityExecutionStatus.Closed) return ActivityExecutionStatus.Closed; return ActivityExecutionStatus.Canceling;}
D.
protected override ActivityExecutionStatus Cancel( ActivityExecutionContext context) { ActivityExecutionStatus childStatus = EnabledActivities[0].ExecutionStatus; if (childStatus == ActivityExecutionStatus.Canceling) context.CancelActivity(EnabledActivities[0]); else if (childStatus == ActivityExecutionStatus.Executing) return ActivityExecutionStatus.Executing; return ActivityExecutionStatus.Closed;}