Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r00cd167e5b3fe6e817e063ab654459c90e550aea --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (.../HydraulicLocationConfigurationDatabaseReader.cs) (revision 00cd167e5b3fe6e817e063ab654459c90e550aea) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Data; using System.Data.SQLite; -using System.Linq; using Core.Common.Base.IO; using Core.Common.IO.Exceptions; using Core.Common.IO.Readers; @@ -87,40 +86,6 @@ } /// - /// Gets whether the preprocessor can be used for the given . - /// - /// The hydraulic boundary track id. - /// The value found in the database; or false when the database - /// is valid but outdated (no UsePreprocessor column present). - /// Thrown when the database query failed or when no results could be found. - /// Thrown when the database returned incorrect values for - /// required properties. - public bool GetCanUsePreprocessorByTrackId(long trackId) - { - var trackParameter = new SQLiteParameter - { - DbType = DbType.String, - ParameterName = TracksTableDefinitions.TrackId, - Value = trackId - }; - - try - { - return GetCanUsePreprocessorFromDatabase(trackParameter); - } - catch (SQLiteException exception) - { - string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception); - throw new CriticalFileReadException(message, exception); - } - catch (FormatException exception) - { - string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); - throw new LineParseException(message, exception); - } - } - - /// /// Gets the location ids from the database, based upon . /// /// A parameter containing the hydraulic boundary track id. @@ -150,40 +115,8 @@ } } } + return dictionary; } - - /// - /// Gets whether the preprocessor can be used for the given . - /// - /// A parameter containing the hydraulic boundary track id. - /// The value found in the database; or false when the database - /// is valid but outdated (no UsePreprocessor column present). - /// Thrown when the database query failed. - /// Thrown when the database returned incorrect values for - /// required properties. - /// Thrown when no results could be found. - private bool GetCanUsePreprocessorFromDatabase(SQLiteParameter trackParameter) - { - string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetRegionByTrackIdQuery(); - using (IDataReader dataReader = CreateDataReader(query, trackParameter)) - { - DataTable schemaTable = dataReader.GetSchemaTable(); - DataColumn columnName = schemaTable.Columns[schemaTable.Columns.IndexOf("ColumnName")]; - - if (schemaTable.Rows.Cast().All(row => row[columnName].ToString() != RegionsTableDefinitions.UsePreprocessor)) - { - return false; - } - - if (MoveNext(dataReader)) - { - return Convert.ToBoolean(dataReader[RegionsTableDefinitions.UsePreprocessor]); - } - - string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception); - throw new CriticalFileReadException(message); - } - } } } \ No newline at end of file