Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs =================================================================== diff -u -r916bdbd134da55d8f1373fea9b29aba97db34348 -r3e170ea1e6909370ffab6cf597cfaa63bcbc3a71 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs (.../ClosingStructuresDataSynchronizationService.cs) (revision 916bdbd134da55d8f1373fea9b29aba97db34348) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs (.../ClosingStructuresDataSynchronizationService.cs) (revision 3e170ea1e6909370ffab6cf597cfaa63bcbc3a71) @@ -81,6 +81,39 @@ } /// + /// Clears all structures, unassigns them from the calculations in the + /// and clears all data that depends on it, either directly or indirectly. + /// + /// The to + /// clear the structures from. + /// All objects that are affected by this operation. + /// Thrown when any parameter is null. + public static IEnumerable RemoveAllStructures(ClosingStructuresFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + IEnumerable> calculations = + failureMechanism.Calculations.Cast>(); + StructuresCalculation[] calculationWithRemovedStructure = calculations + .Where(c => c.InputParameters.Structure != null) + .ToArray(); + + List changedObservables = ClearStructureDependentData( + failureMechanism.SectionResults2, + calculationWithRemovedStructure, + calculations); + + StructureCollection structures = failureMechanism.ClosingStructures; + structures.Clear(); + changedObservables.Add(structures); + + return changedObservables; + } + + /// /// Clears the output for all calculations in the . /// /// The