Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicDatabaseHelper.cs
===================================================================
diff -u -r2cf2214c4069c98c3cb21708729fcbc2ca964ab6 -r8476d48f3aa0d36c866433c29be238aa52abcfe4
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicDatabaseHelper.cs (.../HydraulicDatabaseHelper.cs) (revision 2cf2214c4069c98c3cb21708729fcbc2ca964ab6)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicDatabaseHelper.cs (.../HydraulicDatabaseHelper.cs) (revision 8476d48f3aa0d36c866433c29be238aa52abcfe4)
@@ -1,6 +1,8 @@
-using System.IO;
+using System;
+using System.IO;
using Core.Common.IO.Exceptions;
using log4net;
+using Ringtoets.HydraRing.Data;
using Ringtoets.HydraRing.IO.HydraulicBoundaryDatabaseContext;
using Ringtoets.HydraRing.IO.HydraulicLocationConfigurationDatabaseContext;
@@ -32,5 +34,48 @@
}
return null;
}
+
+ ///
+ /// Returns the version from the database pointed at by the .
+ ///
+ /// The location of the database.
+ /// The version from the database as a .
+ /// Thrown when no connection with the hydraulic
+ /// boundary database could be created.
+ private static string GetVersion(string filePath)
+ {
+ using (var db = new HydraulicBoundarySqLiteDatabaseReader(filePath))
+ {
+ return db.GetVersion();
+ }
+ }
+
+ ///
+ /// Checks whether the version of a matches the version
+ /// of a database at the given .
+ ///
+ /// The database to compare the version of.
+ /// The path to the database to compare the version of.
+ /// true if is of the given ,
+ /// false otherwise.
+ /// Thrown when no connection with the hydraulic
+ /// boundary database could be created using .
+ /// Thrown when:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ public static bool HaveEqualVersion(HydraulicBoundaryDatabase database, string pathToDatabase)
+ {
+ if (database == null)
+ {
+ throw new ArgumentNullException("database");
+ }
+ if (pathToDatabase == null)
+ {
+ throw new ArgumentNullException("pathToDatabase");
+ }
+ return database.Version == GetVersion(pathToDatabase);
+ }
}
}
\ No newline at end of file