Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs =================================================================== diff -u -r87c8cbe523ecd4a197993251f0cf80b521cc3c20 -rff28b61980b68b15722adaf34f3c71321dd1b47e --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision 87c8cbe523ecd4a197993251f0cf80b521cc3c20) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision ff28b61980b68b15722adaf34f3c71321dd1b47e) @@ -67,7 +67,7 @@ /// Gets the location ids from the database, based upon . /// /// The hydraulic boundary track id. - /// A dictionary with pairs of Hrd location id (key) and location id (value) as found in the database. + /// A collection of as found in the database. /// Thrown when the database query failed. /// Thrown when the database returned incorrect values for /// required properties. @@ -100,14 +100,15 @@ /// Gets the location ids from the database, based upon . /// /// A parameter containing the hydraulic boundary track id. - /// A dictionary with pairs of Hrd location id (key) and location id (value) as found in the database. + /// A collection of as found in the database. /// Thrown when the database query failed. /// Thrown when the database returned incorrect values for /// required properties. private IEnumerable GetLocationIdsFromDatabase(SQLiteParameter trackParameter) { - var mappings = new List(); string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetLocationIdsByTrackIdQuery(); + var locationLookup = new Dictionary(); + using (IDataReader dataReader = CreateDataReader(query, trackParameter)) { while (MoveNext(dataReader)) @@ -116,18 +117,18 @@ long hlcdLocationId = Convert.ToInt64(dataReader[LocationsTableDefinitions.LocationId]); // Must be unique - if (mappings.Any(m => m.HrdLocationId == hrdLocationId)) + if (locationLookup.ContainsKey(hrdLocationId)) { log.Warn(Resources.HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_Row_Found_Take_First); } else { - mappings.Add(new ReadHydraulicLocationMapping(hrdLocationId, hlcdLocationId)); + locationLookup[hrdLocationId] = hlcdLocationId; } } } - return mappings; + return locationLookup.Select(lookup => new ReadHydraulicLocationMapping(lookup.Key, lookup.Value)).ToArray(); } } } \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs =================================================================== diff -u -r4bb3d8d1b4b5e3a303294163f0218e3176caeb85 -rff28b61980b68b15722adaf34f3c71321dd1b47e --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs (.../ReadHydraulicLocationMapping.cs) (revision 4bb3d8d1b4b5e3a303294163f0218e3176caeb85) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs (.../ReadHydraulicLocationMapping.cs) (revision ff28b61980b68b15722adaf34f3c71321dd1b47e) @@ -22,7 +22,7 @@ namespace Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabase { /// - /// Class for holding location mapping data that is read from a hydraulic location configuration database file. + /// Class for holding a mapping between the hydraulic boundary location id and hydraulic location configuration id. /// public class ReadHydraulicLocationMapping {