Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs =================================================================== diff -u -r6f46ce9a263e50bca4ff0cb32973f330defd6f3b -rdee01f6d6c15af0cc124816bfe99c7658af8995d --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision 6f46ce9a263e50bca4ff0cb32973f330defd6f3b) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision dee01f6d6c15af0cc124816bfe99c7658af8995d) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using Core.Common.Base; using Ringtoets.Common.Data.Structures; @@ -66,29 +65,22 @@ /// /// The /// which contains the calculations. - /// An of calculations which are affected by - /// removing data. + /// An of objects which are affected by removing data. /// Thrown when /// is null. - public static IEnumerable> ClearAllCalculationOutputAndHydraulicBoundaryLocations( + public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations( StabilityPointStructuresFailureMechanism failureMechanism) { if (failureMechanism == null) { throw new ArgumentNullException("failureMechanism"); } - var affectedItems = new Collection>(); - + var affectedItems = new List(); foreach (var calculation in failureMechanism.Calculations.Cast>()) { - var calculationChanged = RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation) - .Concat(ClearHydraulicBoundaryLocation(calculation.InputParameters)) - .Any(); - if (calculationChanged) - { - affectedItems.Add(calculation); - } + affectedItems.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation) + .Concat(ClearHydraulicBoundaryLocation(calculation.InputParameters))); } return affectedItems; @@ -127,25 +119,25 @@ /// Removes the given stability point structure and all dependent data, either /// directly or indirectly, from the failure mechanism. /// - /// The failure mechanism with at least 1 structure. + /// The failure mechanism containing . /// The structure to be removed. /// All objects affected by the removal. public static IEnumerable RemoveStructure(StabilityPointStructuresFailureMechanism failureMechanism, StabilityPointStructure structure) { var changedObservables = new HashSet(); - StructuresCalculation[] heightStructureCalculations = failureMechanism.Calculations - .Cast>() - .ToArray(); - StructuresCalculation[] calculationWithRemovedStabilityPointStructure = heightStructureCalculations + StructuresCalculation[] stabilityPointStructureCalculations = failureMechanism.Calculations + .Cast>() + .ToArray(); + StructuresCalculation[] calculationWithRemovedStabilityPointStructure = stabilityPointStructureCalculations .Where(c => ReferenceEquals(c.InputParameters.Structure, structure)) .ToArray(); foreach (StructuresCalculation calculation in calculationWithRemovedStabilityPointStructure) { calculation.InputParameters.Structure = null; IEnumerable> affectedSectionResults = - StructuresHelper.Delete(failureMechanism.SectionResults, calculation, heightStructureCalculations); + StructuresHelper.Delete(failureMechanism.SectionResults, calculation, stabilityPointStructureCalculations); foreach (StructuresFailureMechanismSectionResult result in affectedSectionResults) { changedObservables.Add(result);