Inheritance: Taskling.InfrastructureContracts.TaskExecution.RequestBase
        public void Complete()
        {
            if (!_started || _completeCalled)
                throw new ExecutionException("There is no active critical section to complete");

            var completeRequest = new CompleteCriticalSectionRequest(new TaskId(_taskExecutionInstance.ApplicationName, _taskExecutionInstance.TaskName),
                _taskExecutionInstance.TaskExecutionId,
                _criticalSectionType);

            _criticalSectionRepository.Complete(completeRequest);

            _completeCalled = true;
        }
 public CompleteCriticalSectionResponse Complete(CompleteCriticalSectionRequest completeRequest)
 {
     var taskDefinition = _taskRepository.EnsureTaskDefinition(completeRequest.TaskId);
     return ReturnCriticalSectionToken(completeRequest.TaskId, taskDefinition.TaskDefinitionId, completeRequest.TaskExecutionId, completeRequest.Type);
 }