private void UpdateChildrenSchemes(ProcessInstancesTree currentNode, ProcessDefinition oldRootScheme, ProcessDefinition newRootScheme, List<SchemaWasChangedEventArgs> changes) { if (!currentNode.Children.Any<ProcessInstancesTree>()) { return; } foreach (ProcessInstancesTree child in currentNode.Children) { ProcessInstance processInstance = this.Builder.GetProcessInstance(child.Id); bool flag = false; try { this.SetProcessNewStatus(processInstance, ProcessStatus.Running); this.PersistenceProvider.FillSystemProcessParameters(processInstance); if (processInstance.CurrentActivity.IsAutoSchemeUpdate) { TransitionDefinition transitionDefinition = null; try { transitionDefinition = newRootScheme.FindTransition(child.Name); } catch (TransitionNotFoundException transitionNotFoundException) { } if (transitionDefinition != null) { ProcessDefinition processDefinition = this.Builder.CreateNewSubprocessScheme(newRootScheme, transitionDefinition); this.BindProcessToNewScheme(processInstance, processDefinition, changes); } else if (this.OnStartingTransitionNotFound == null) { this.DropProcesses(new List<Guid>() { processInstance.ProcessId }, currentNode); flag = true; continue; } else { StartingTransitionNotFoundEventArgs startingTransitionNotFoundEventArg = new StartingTransitionNotFoundEventArgs(processInstance.ProcessId, processInstance.RootProcessId, oldRootScheme, newRootScheme, child.Name); this.OnStartingTransitionNotFound(this, startingTransitionNotFoundEventArg); if (startingTransitionNotFoundEventArg.Decision == StartingTransitionNotFoundEventArgs.SubprocessUpdateDecision.DropProcess) { this.DropProcesses(new List<Guid>() { processInstance.ProcessId }, currentNode); flag = true; continue; } else if (startingTransitionNotFoundEventArg.Decision == StartingTransitionNotFoundEventArgs.SubprocessUpdateDecision.Ignore) { continue; } else if (startingTransitionNotFoundEventArg.Decision == StartingTransitionNotFoundEventArgs.SubprocessUpdateDecision.StartWithNewTransition) { transitionDefinition = newRootScheme.FindTransition(startingTransitionNotFoundEventArg.NewTransitionName); ProcessDefinition processDefinition1 = this.Builder.CreateNewSubprocessScheme(newRootScheme, transitionDefinition); this.BindProcessToNewScheme(processInstance, processDefinition1, changes); } } } this.UpdateChildrenSchemes(child, oldRootScheme, newRootScheme, changes); } finally { if (!flag) { this.SetIdledStatusAfterSchemaUpdated(processInstance); } } } }