Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision ce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base; +using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Service; @@ -90,29 +91,37 @@ /// Clears all data dependent, either directly or indirectly, on the parent reference line. /// /// The failure mechanism to be cleared. - /// All objects that have been changed. - public static IEnumerable ClearReferenceLineDependentData(StabilityPointStructuresFailureMechanism failureMechanism) + /// The results of the clear action. + /// Thrown when + /// is null. + public static ClearResults ClearReferenceLineDependentData(StabilityPointStructuresFailureMechanism failureMechanism) { if (failureMechanism == null) { throw new ArgumentNullException("failureMechanism"); } - var observables = new List(); + var changedObjects = new List(); + var removedObjects = failureMechanism.Sections.OfType() + .Concat(failureMechanism.SectionResults) + .Concat(failureMechanism.CalculationsGroup.GetAllChildrenRecursive()) + .Concat(failureMechanism.ForeshoreProfiles) + .Concat(failureMechanism.StabilityPointStructures) + .ToArray(); failureMechanism.ClearAllSections(); - observables.Add(failureMechanism); + changedObjects.Add(failureMechanism); failureMechanism.CalculationsGroup.Children.Clear(); - observables.Add(failureMechanism.CalculationsGroup); + changedObjects.Add(failureMechanism.CalculationsGroup); failureMechanism.ForeshoreProfiles.Clear(); - observables.Add(failureMechanism.ForeshoreProfiles); + changedObjects.Add(failureMechanism.ForeshoreProfiles); failureMechanism.StabilityPointStructures.Clear(); - observables.Add(failureMechanism.StabilityPointStructures); + changedObjects.Add(failureMechanism.StabilityPointStructures); - return observables; + return new ClearResults(changedObjects, removedObjects); } ///