Index: Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs =================================================================== diff -u -r4e369a958ac3a703a363edc5c10a0843be6fb4c6 -r07a41d094be62c976b11a052a1baf5781a534dbc --- Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision 4e369a958ac3a703a363edc5c10a0843be6fb4c6) +++ Riskeer/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision 07a41d094be62c976b11a052a1baf5781a534dbc) @@ -63,12 +63,12 @@ /// Thrown when the database returned incorrect values for required properties. public ReadHydraulicLocationConfigurationDatabase Read(long trackId) { - return new ReadHydraulicLocationConfigurationDatabase(GetFromDatabase(() => GetLocationIdsFromDatabase(new SQLiteParameter + return new ReadHydraulicLocationConfigurationDatabase(GetFromDatabase(() => GetHydraulicLocationsFromDatabase(new SQLiteParameter { DbType = DbType.String, ParameterName = LocationsTableDefinitions.TrackId, Value = trackId - })), + })).Where(rhl => rhl.TrackId == trackId), IsScenarioInformationTablePresent() ? GetConfigurationSettings() : null, @@ -82,31 +82,18 @@ /// 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) + private IEnumerable GetHydraulicLocationsFromDatabase(SQLiteParameter trackParameter) { - var locationLookup = new Dictionary(); - using (IDataReader dataReader = CreateDataReader(HydraulicLocationConfigurationDatabaseQueryBuilder.GetLocationIdsByTrackIdQuery(), trackParameter)) { while (MoveNext(dataReader)) { - var hrdLocationId = dataReader.Read(LocationsTableDefinitions.HrdLocationId); - var hlcdLocationId = dataReader.Read(LocationsTableDefinitions.LocationId); - - // Must be unique - if (locationLookup.ContainsKey(hrdLocationId)) - { - log.Warn(Resources.HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_Row_Found_Take_First); - } - else - { - locationLookup[hrdLocationId] = hlcdLocationId; - } + yield return new ReadHydraulicLocation(dataReader.Read(LocationsTableDefinitions.LocationId), + dataReader.Read(LocationsTableDefinitions.HrdLocationId), + 1); } } - - return locationLookup.Select(lookup => new ReadHydraulicLocation(lookup.Value, lookup.Key, 1)).ToArray(); } /// Index: Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs =================================================================== diff -u -rd8901a860a022433ecff7cd3f98e2b9934a93a42 -r07a41d094be62c976b11a052a1baf5781a534dbc --- Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d8901a860a022433ecff7cd3f98e2b9934a93a42) +++ Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 07a41d094be62c976b11a052a1baf5781a534dbc) @@ -107,15 +107,5 @@ return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception", resourceCulture); } } - - /// - /// Looks up a localized string similar to Er zijn meerdere resultaten gevonden, wat niet voor zou mogen komen. Neem contact op met de leverancier. Het eerste resultaat zal worden gebruikt.. - /// - internal static string HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_Row_Found_Take_First { - get { - return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_" + - "Row_Found_Take_First", resourceCulture); - } - } } } Index: Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx =================================================================== diff -u -rd8901a860a022433ecff7cd3f98e2b9934a93a42 -r07a41d094be62c976b11a052a1baf5781a534dbc --- Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx (.../Resources.resx) (revision d8901a860a022433ecff7cd3f98e2b9934a93a42) +++ Riskeer/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx (.../Resources.resx) (revision 07a41d094be62c976b11a052a1baf5781a534dbc) @@ -123,9 +123,6 @@ Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database. - - Er zijn meerdere resultaten gevonden, wat niet voor zou mogen komen. Neem contact op met de leverancier. Het eerste resultaat zal worden gebruikt. - Het bevragen van de database is mislukt.