Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs =================================================================== diff -u -r41a37c93cb0b3e36ff7023c9f42b4e6225598b55 -r04cb34562587c9b06345f2e639c57394e6a7d0a7 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 41a37c93cb0b3e36ff7023c9f42b4e6225598b55) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 04cb34562587c9b06345f2e639c57394e6a7d0a7) @@ -26,6 +26,7 @@ using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Structures; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.HeightStructures.Data; using Ringtoets.HydraRing.Data; @@ -54,6 +55,7 @@ private readonly Dictionary heightStructures = CreateDictionary(); private readonly Dictionary closingStructures = CreateDictionary(); private readonly Dictionary stabilityPointStructures = CreateDictionary(); + private readonly Dictionary> heightStructuresCalculations = CreateDictionary>(); private static Dictionary CreateDictionary() { @@ -852,6 +854,77 @@ #endregion + #region HeightStructuresCalculationEntity: Read, Contains, Get + + /// + /// Registers a read operation for + /// and the that was constructed + /// with the information. + /// + /// The + /// that was read. + /// The that + /// was constructed. + /// Thrown when any input parameter is null. + internal void Read(HeightStructuresCalculationEntity entity, StructuresCalculation model) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + if (model == null) + { + throw new ArgumentNullException("model"); + } + + heightStructuresCalculations[entity] = model; + } + + /// + /// Checks whether a read operation has been registered for a given . + /// + /// The to check for. + /// true if the was read before, false otherwise. + /// Thrown when is null. + internal bool Contains(HeightStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + return heightStructuresCalculations.ContainsKey(entity); + } + + /// + /// Obtains the which was read + /// for the given . + /// + /// The for which a read + /// operation has been registered. + /// The constructed . + /// Thrown when is null. + /// Thrown when no read operation has + /// been registered for . + /// Use + /// to find out whether a read operation has been registered for . + internal StructuresCalculation Get(HeightStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + try + { + return heightStructuresCalculations[entity]; + } + catch (KeyNotFoundException e) + { + throw new InvalidOperationException(e.Message, e); + } + } + + #endregion + #region ClosingStructureEntity: Read, Contains, Get ///