Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.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; @@ -87,31 +88,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. + /// The results of the clear action. /// Thrown when /// is null. - public static IEnumerable ClearReferenceLineDependentData(HeightStructuresFailureMechanism failureMechanism) + public static ClearResults ClearReferenceLineDependentData(HeightStructuresFailureMechanism 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.HeightStructures) + .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.HeightStructures.Clear(); - observables.Add(failureMechanism.HeightStructures); + changedObjects.Add(failureMechanism.HeightStructures); - return observables; + return new ClearResults(changedObjects, removedObjects); } ///