Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/ClosingStructuresImporter.cs =================================================================== diff -u -ra7f920661887773056c051edc7872d27f724c840 -r12cec002453a1828efc68633fbd25219632c6c47 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/ClosingStructuresImporter.cs (.../ClosingStructuresImporter.cs) (revision a7f920661887773056c051edc7872d27f724c840) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/ClosingStructuresImporter.cs (.../ClosingStructuresImporter.cs) (revision 12cec002453a1828efc68633fbd25219632c6c47) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Core.Common.Base; using Core.Common.Base.Data; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data; @@ -39,6 +38,8 @@ /// public class ClosingStructuresImporter : StructuresImporter> { + private readonly IStructureUpdateStrategy structureUpdateStrategy; + /// /// Creates a new instance of . /// @@ -47,15 +48,29 @@ /// objects found in the file are intersecting it. /// The path to the file to import from. /// The message provider to provide messages during importer actions. + /// The strategy to update the structures with imported data. /// Thrown when any of the input parameters is null. public ClosingStructuresImporter(StructureCollection importTarget, - ReferenceLine referenceLine, string filePath, IImporterMessageProvider messageProvider) - : base(importTarget, referenceLine, filePath, messageProvider) {} + ReferenceLine referenceLine, + string filePath, + IImporterMessageProvider messageProvider, + IStructureUpdateStrategy updateStrategy) + : base(importTarget, referenceLine, filePath, messageProvider) + { + if (updateStrategy == null) + { + throw new ArgumentNullException(nameof(updateStrategy)); + } + structureUpdateStrategy = updateStrategy; + } protected override void CreateSpecificStructures(ICollection structureLocations, Dictionary> groupedStructureParameterRows) { - ImportTarget.AddRange(CreateClosingStructures(structureLocations.ToList(), groupedStructureParameterRows), FilePath); + structureUpdateStrategy.UpdateStructuresWithImportedData(ImportTarget, + CreateClosingStructures(structureLocations.ToList(), + groupedStructureParameterRows), + FilePath); } private IEnumerable CreateClosingStructures(IEnumerable structureLocations,