Index: Ringtoets/Integration/src/Ringtoets.Integration.Service/RingtoetsDataSynchronizationService.cs =================================================================== diff -u -rc964c048005d93b097a1e6a817dace95b293040f -rffe405e6b0f8b4d10e6be78cf7735c554eb42a93 --- Ringtoets/Integration/src/Ringtoets.Integration.Service/RingtoetsDataSynchronizationService.cs (.../RingtoetsDataSynchronizationService.cs) (revision c964c048005d93b097a1e6a817dace95b293040f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Service/RingtoetsDataSynchronizationService.cs (.../RingtoetsDataSynchronizationService.cs) (revision ffe405e6b0f8b4d10e6be78cf7735c554eb42a93) @@ -28,6 +28,7 @@ using Ringtoets.ClosingStructures.Service; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Service; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -231,7 +232,7 @@ var list = new List(); - foreach (var failureMechanism in assessmentSection.GetFailureMechanisms()) + foreach (IFailureMechanism failureMechanism in assessmentSection.GetFailureMechanisms()) { var pipingFailureMechanism = failureMechanism as PipingFailureMechanism; var grassCoverErosionInwardsFailureMechanism = failureMechanism as GrassCoverErosionInwardsFailureMechanism; @@ -246,34 +247,38 @@ { list.AddRange(PipingDataSynchronizationService.ClearReferenceLineDependentData(pipingFailureMechanism)); } - if (grassCoverErosionInwardsFailureMechanism != null) + else if (grassCoverErosionInwardsFailureMechanism != null) { list.AddRange(GrassCoverErosionInwardsDataSynchronizationService.ClearReferenceLineDependentData(grassCoverErosionInwardsFailureMechanism)); } - if (stabilityStoneCoverFailureMechanism != null) + else if (stabilityStoneCoverFailureMechanism != null) { list.AddRange(StabilityStoneCoverDataSynchronizationService.ClearReferenceLineDependentData(stabilityStoneCoverFailureMechanism)); } - if (waveImpactAsphaltCoverFailureMechanism != null) + else if (waveImpactAsphaltCoverFailureMechanism != null) { list.AddRange(WaveImpactAsphaltCoverDataSynchronizationService.ClearReferenceLineDependentData(waveImpactAsphaltCoverFailureMechanism)); } - if (grassCoverErosionOutwardsFailureMechanism != null) + else if (grassCoverErosionOutwardsFailureMechanism != null) { list.AddRange(GrassCoverErosionOutwardsDataSynchronizationService.ClearReferenceLineDependentData(grassCoverErosionOutwardsFailureMechanism)); } - if (heightStructuresFailureMechanism != null) + else if (heightStructuresFailureMechanism != null) { list.AddRange(HeightStructuresDataSynchronizationService.ClearReferenceLineDependentData(heightStructuresFailureMechanism)); } - if (closingStructuresFailureMechanism != null) + else if (closingStructuresFailureMechanism != null) { list.AddRange(ClosingStructuresDataSynchronizationService.ClearReferenceLineDependentData(closingStructuresFailureMechanism)); } - if (stabilityPointStructuresFailureMechanism != null) + else if (stabilityPointStructuresFailureMechanism != null) { list.AddRange(StabilityPointStructuresDataSynchronizationService.ClearReferenceLineDependentData(stabilityPointStructuresFailureMechanism)); } + else + { + list.AddRange(ClearReferenceLineDependentData(failureMechanism)); + } } // Lastly: clear the reference line: @@ -282,5 +287,14 @@ return list; } + + private static IEnumerable ClearReferenceLineDependentData(IFailureMechanism failureMechanism) + { + failureMechanism.ClearAllSections(); + return new[] + { + failureMechanism + }; + } } } \ No newline at end of file