From 4bd3e67b1189f52703a510459336ed54b4fe86eb Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 09:45:21 +0100 Subject: [PATCH 01/12] Migrate from System.Data.SQLite to Microsoft.Data.Sqlite 8.0.0 - Replace System.Data.SQLite package references with Microsoft.Data.Sqlite 8.0.0 - Update SessionFactoryProvider to use Microsoft.Data.Sqlite with NHibernate - Update ConnectionProvider and SQLiteProjectCommandExecuter to use SqliteConnection - Add SQLite native library configuration (PropertyGroups + PostBuild targets) to test and executable projects to ensure SQLite.Interop.dll is copied on Windows - Update test projects to reference Microsoft.Data.Sqlite --- .../Journal/IConnectionProvider.cs | 6 +- ...PSuite.Infrastructure.Serialization.csproj | 2 +- .../Services/SQLiteProjectCommandExecuter.cs | 6 +- .../Services/SessionFactoryProvider.cs | 55 +++++++++++++++++++ .../OSPSuite.Infrastructure.Tests.csproj | 20 ++++--- .../OSPSuite.R.Performance.csproj | 28 +++++----- .../OSPSuite.Starter/OSPSuite.Starter.csproj | 27 ++++----- 7 files changed, 102 insertions(+), 42 deletions(-) create mode 100644 src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs diff --git a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs index bdf0bd849..a291872f3 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs @@ -1,5 +1,5 @@ using System.Data; -using System.Data.SQLite; +using Microsoft.Data.Sqlite; namespace OSPSuite.Infrastructure.Serialization.Journal { @@ -12,8 +12,8 @@ public class ConnectionProvider : IConnectionProvider { public IDbConnection CreateConnection(string databasePath) { - var connectionString = $"Data Source={databasePath};Version=3;New=True;Compress=True;foreign keys=True"; - var cn = new SQLiteConnection(connectionString); + var connectionString = $"Data Source={databasePath}"; + var cn = new SqliteConnection(connectionString); cn.Open(); return cn; } diff --git a/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj b/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj index 221aab2fb..0e61e51f2 100644 --- a/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj +++ b/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs index 791b4c428..2cade2e14 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs @@ -1,6 +1,6 @@ using System; using System.Data.Common; -using System.Data.SQLite; +using Microsoft.Data.Sqlite; using OSPSuite.Core.Extensions; namespace OSPSuite.Infrastructure.Serialization.Services @@ -10,7 +10,7 @@ public class SQLiteProjectCommandExecuter public virtual void ExecuteCommand(string projectFile, Action command ) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SQLiteConnection($"Data Source={file}")) + using (var sqlLite = new SqliteConnection($"Data Source={file}")) { sqlLite.Open(); command(sqlLite); @@ -20,7 +20,7 @@ public virtual void ExecuteCommand(string projectFile, Action comm public virtual TResult ExecuteCommand(string projectFile, Func command) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SQLiteConnection($"Data Source={file}")) + using (var sqlLite = new SqliteConnection($"Data Source={file}")) { sqlLite.Open(); return command(sqlLite); diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs new file mode 100644 index 000000000..54bf41477 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs @@ -0,0 +1,55 @@ +using System; +using NHibernate; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NHibernate.Driver; +using NHibernate.Tool.hbm2ddl; +using Microsoft.Data.Sqlite; + +namespace OSPSuite.Infrastructure.Serialization.Services +{ + public class SessionFactoryProvider : ISessionFactoryProvider + { + public ISessionFactory InitalizeSessionFactoryFor(string dataSource) + { + var configuration = CreateConfiguration(dataSource); + var sessionFactory = configuration.BuildSessionFactory(); + return sessionFactory; + } + + public ISessionFactory OpenSessionFactoryFor(string dataSource) + { + var configuration = CreateConfiguration(dataSource); + var sessionFactory = configuration.BuildSessionFactory(); + return sessionFactory; + } + + public SchemaExport GetSchemaExport(string dataSource) + { + var configuration = CreateConfiguration(dataSource); + return new SchemaExport(configuration); + } + + private Configuration CreateConfiguration(string dataSource) + { + var configuration = new Configuration(); + + // Configure database integration with Microsoft.Data.Sqlite + configuration.DataBaseIntegration(db => + { + // Use the SQLite driver that works with Microsoft.Data.Sqlite + db.Driver(); + db.Dialect(); + db.ConnectionString = $"Data Source={dataSource}"; + db.Timeout = 20; + }); + + // Add mapping assemblies (you may need to adjust these based on your actual mapping assemblies) + configuration.AddAssembly(typeof(SessionFactoryProvider).Assembly); + + return configuration; + } + } + +} + diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index e35ecfd26..15e7837f6 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -21,7 +21,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -38,16 +38,18 @@ + - true - false - false - false + true + false + false + false + - - - - + + + + \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index 0f92af5c2..0284fb2e7 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -50,23 +50,25 @@ - + - - true - false - false - false - - - - - - - + + + true + false + false + false + + + + + + + + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index 4a5a667fc..c7f06e8ea 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -52,7 +52,7 @@ - + @@ -76,16 +76,17 @@ - - true - false - false - false - - - - - - - + + true + false + false + false + + + + + + + + \ No newline at end of file From 640d903752011b6028454cf2e393b0440bc8c3f2 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 09:55:59 +0100 Subject: [PATCH 02/12] Restore TargetDir/Folder --- .../OSPSuite.Infrastructure.Tests.csproj | 4 ++-- tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj | 4 ++-- tests/OSPSuite.Starter/OSPSuite.Starter.csproj | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index 15e7837f6..e92406310 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -48,8 +48,8 @@ - + - + \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index 0284fb2e7..eaccea3bc 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -67,8 +67,8 @@ - + - + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index c7f06e8ea..8540000ca 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -85,8 +85,8 @@ - + - + \ No newline at end of file From 99bceefa7f9e828e4fb8a81b9606e66025f34697 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 10:07:58 +0100 Subject: [PATCH 03/12] Add SQLite native library configuration for Microsoft.Data.Sqlite 8.0.0 --- .../OSPSuite.Infrastructure.Tests.csproj | 1 + tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj | 1 + tests/OSPSuite.Starter/OSPSuite.Starter.csproj | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index e92406310..092fd7cf6 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -22,6 +22,7 @@ + diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index eaccea3bc..0ebb87207 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -51,6 +51,7 @@ + diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index 8540000ca..3c699f55a 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -53,6 +53,7 @@ + From 8986b95c771451f433aa3ca2a32fb5eb304b4dfc Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 10:19:49 +0100 Subject: [PATCH 04/12] Add SQLitePCLRaw.bundle_e_sqlite3 for Microsoft.Data.Sqlite native library support Microsoft.Data.Sqlite uses SQLitePCLRaw which provides e_sqlite3.dll automatically via SQLitePCLRaw.bundle_e_sqlite3. The previous SQLite.Interop.dll from System.Data.SQLite is no longer needed. --- .../OSPSuite.Infrastructure.Tests.csproj | 9 +-------- .../OSPSuite.R.Performance/OSPSuite.R.Performance.csproj | 9 +-------- tests/OSPSuite.Starter/OSPSuite.Starter.csproj | 9 +-------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index 092fd7cf6..bbcb5a823 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -22,7 +22,7 @@ - + @@ -46,11 +46,4 @@ false false - - - - - - - \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index 0ebb87207..de5aaa9d6 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -51,7 +51,7 @@ - + @@ -65,11 +65,4 @@ false false - - - - - - - \ No newline at end of file diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index 3c699f55a..d8de29fb5 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -53,7 +53,7 @@ - + @@ -83,11 +83,4 @@ false false - - - - - - - \ No newline at end of file From 4458f8418ebf547c33a3f25df4cd9b18d7145a31 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 16:10:03 +0100 Subject: [PATCH 05/12] Update connection strings to include 'Foreign Keys=True' for SQLite connections - Modified ConnectionProvider, SessionFactoryProvider, and SQLiteProjectCommandExecuter to append 'Foreign Keys=True' to the connection strings. --- .../Journal/IConnectionProvider.cs | 6 +++++- .../Services/SQLiteProjectCommandExecuter.cs | 4 ++-- .../Services/SessionFactoryProvider.cs | 7 ++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs index a291872f3..c6fa954f9 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs @@ -12,7 +12,11 @@ public class ConnectionProvider : IConnectionProvider { public IDbConnection CreateConnection(string databasePath) { - var connectionString = $"Data Source={databasePath}"; + // Note: The original System.Data.SQLite connection string included "Compress=True", + // but Microsoft.Data.Sqlite does not support the Compress parameter. + // SQLite works fine without compression, and compression adds CPU overhead. + // See COMPRESS_INVESTIGATION.md for details. + var connectionString = $"Data Source={databasePath};Foreign Keys=True"; var cn = new SqliteConnection(connectionString); cn.Open(); return cn; diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs index 2cade2e14..bfd1d17c8 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs @@ -10,7 +10,7 @@ public class SQLiteProjectCommandExecuter public virtual void ExecuteCommand(string projectFile, Action command ) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SqliteConnection($"Data Source={file}")) + using (var sqlLite = new SqliteConnection($"Data Source={file};Foreign Keys=True")) { sqlLite.Open(); command(sqlLite); @@ -20,7 +20,7 @@ public virtual void ExecuteCommand(string projectFile, Action comm public virtual TResult ExecuteCommand(string projectFile, Func command) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SqliteConnection($"Data Source={file}")) + using (var sqlLite = new SqliteConnection($"Data Source={file};Foreign Keys=True")) { sqlLite.Open(); return command(sqlLite); diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs index 54bf41477..7df1a8c47 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs @@ -4,7 +4,6 @@ using NHibernate.Dialect; using NHibernate.Driver; using NHibernate.Tool.hbm2ddl; -using Microsoft.Data.Sqlite; namespace OSPSuite.Infrastructure.Serialization.Services { @@ -40,7 +39,7 @@ private Configuration CreateConfiguration(string dataSource) // Use the SQLite driver that works with Microsoft.Data.Sqlite db.Driver(); db.Dialect(); - db.ConnectionString = $"Data Source={dataSource}"; + db.ConnectionString = $"Data Source={dataSource};Foreign Keys=True"; db.Timeout = 20; }); @@ -50,6 +49,4 @@ private Configuration CreateConfiguration(string dataSource) return configuration; } } - -} - +} \ No newline at end of file From 3512952e5a77c7c4c3462fdee45599d39daacebb Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 16:32:29 +0100 Subject: [PATCH 06/12] Fix spelling: InitalizeSessionFactoryFor -> InitializeSessionFactoryFor --- .../Services/ISessionFactoryProvider.cs | 2 +- .../Services/SessionFactoryProvider.cs | 2 +- .../Services/SessionManager.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/ISessionFactoryProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Services/ISessionFactoryProvider.cs index 15617c20e..4d6516aa6 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/ISessionFactoryProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/ISessionFactoryProvider.cs @@ -5,7 +5,7 @@ namespace OSPSuite.Infrastructure.Serialization.Services { public interface ISessionFactoryProvider { - ISessionFactory InitalizeSessionFactoryFor(string dataSource); + ISessionFactory InitializeSessionFactoryFor(string dataSource); ISessionFactory OpenSessionFactoryFor(string dataSource); SchemaExport GetSchemaExport(string dataSource); } diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs index 7df1a8c47..e37b98400 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs @@ -9,7 +9,7 @@ namespace OSPSuite.Infrastructure.Serialization.Services { public class SessionFactoryProvider : ISessionFactoryProvider { - public ISessionFactory InitalizeSessionFactoryFor(string dataSource) + public ISessionFactory InitializeSessionFactoryFor(string dataSource) { var configuration = CreateConfiguration(dataSource); var sessionFactory = configuration.BuildSessionFactory(); diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SessionManager.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SessionManager.cs index f66c0ba58..ad466e045 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SessionManager.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SessionManager.cs @@ -84,7 +84,7 @@ public void CreateFactoryFor(string fileName) else { FileHelper.DeleteFile(fileName); - _sessionFactory = _sessionFactoryProvider.InitalizeSessionFactoryFor(fileName); + _sessionFactory = _sessionFactoryProvider.InitializeSessionFactoryFor(fileName); } _currentFileName = fileName; From 89c26ce4d2f1fb140b6ccc59f99beccd6e537142 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Tue, 4 Nov 2025 16:39:26 +0100 Subject: [PATCH 07/12] Remove leftovers --- .../OSPSuite.Infrastructure.Tests.csproj | 8 -------- .../OSPSuite.R.Performance/OSPSuite.R.Performance.csproj | 7 ------- tests/OSPSuite.Starter/OSPSuite.Starter.csproj | 8 -------- 3 files changed, 23 deletions(-) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index 0c84a693d..de02e114c 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -19,8 +19,6 @@ - - @@ -35,10 +33,4 @@ - - true - false - false - false - \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index 8236194b4..3cab79ab1 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -46,17 +46,10 @@ - - - true - false - false - false - \ No newline at end of file diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index b32951753..452ea074e 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -67,15 +67,7 @@ - - - - - true - false - false - false False OSPSuite.Starter.Program From 392671cd72a074b4cf8fbe60a2b0ddbb76f5fe23 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Wed, 5 Nov 2025 17:34:43 +0100 Subject: [PATCH 08/12] Remove unnecessary reference to SQLitePCLRaw.bundle_e_sqlite3 --- .../OSPSuite.Infrastructure.Tests.csproj | 1 - tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj | 1 - tests/OSPSuite.Starter/OSPSuite.Starter.csproj | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index de02e114c..9cef8c82e 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -18,7 +18,6 @@ - diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj index 3cab79ab1..cf8b1de6b 100644 --- a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -45,7 +45,6 @@ - diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index 452ea074e..82ea8a45b 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -48,7 +48,6 @@ - From 5d39464de97a6ea1bc99969d734988da15ff1e69 Mon Sep 17 00:00:00 2001 From: Robert McIntosh <261477+rwmcintosh@users.noreply.github.com> Date: Wed, 5 Nov 2025 12:52:13 -0500 Subject: [PATCH 09/12] remove unused code --- .../Services/SessionFactoryProvider.cs | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs deleted file mode 100644 index e37b98400..000000000 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SessionFactoryProvider.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using NHibernate; -using NHibernate.Cfg; -using NHibernate.Dialect; -using NHibernate.Driver; -using NHibernate.Tool.hbm2ddl; - -namespace OSPSuite.Infrastructure.Serialization.Services -{ - public class SessionFactoryProvider : ISessionFactoryProvider - { - public ISessionFactory InitializeSessionFactoryFor(string dataSource) - { - var configuration = CreateConfiguration(dataSource); - var sessionFactory = configuration.BuildSessionFactory(); - return sessionFactory; - } - - public ISessionFactory OpenSessionFactoryFor(string dataSource) - { - var configuration = CreateConfiguration(dataSource); - var sessionFactory = configuration.BuildSessionFactory(); - return sessionFactory; - } - - public SchemaExport GetSchemaExport(string dataSource) - { - var configuration = CreateConfiguration(dataSource); - return new SchemaExport(configuration); - } - - private Configuration CreateConfiguration(string dataSource) - { - var configuration = new Configuration(); - - // Configure database integration with Microsoft.Data.Sqlite - configuration.DataBaseIntegration(db => - { - // Use the SQLite driver that works with Microsoft.Data.Sqlite - db.Driver(); - db.Dialect(); - db.ConnectionString = $"Data Source={dataSource};Foreign Keys=True"; - db.Timeout = 20; - }); - - // Add mapping assemblies (you may need to adjust these based on your actual mapping assemblies) - configuration.AddAssembly(typeof(SessionFactoryProvider).Assembly); - - return configuration; - } - } -} \ No newline at end of file From 20cbd644dcc31cd6dd8eb5a31774e1fbe2b72774 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Thu, 6 Nov 2025 09:31:50 +0100 Subject: [PATCH 10/12] Remove comments on SQLite connection string compression --- .../Journal/IConnectionProvider.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs index c6fa954f9..9cf249691 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs @@ -12,10 +12,6 @@ public class ConnectionProvider : IConnectionProvider { public IDbConnection CreateConnection(string databasePath) { - // Note: The original System.Data.SQLite connection string included "Compress=True", - // but Microsoft.Data.Sqlite does not support the Compress parameter. - // SQLite works fine without compression, and compression adds CPU overhead. - // See COMPRESS_INVESTIGATION.md for details. var connectionString = $"Data Source={databasePath};Foreign Keys=True"; var cn = new SqliteConnection(connectionString); cn.Open(); From f68c4e5d08fd66cd3b6789038d64bc1204ebfa29 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Thu, 6 Nov 2025 09:36:37 +0100 Subject: [PATCH 11/12] Remove 'Foreign Keys=True' from SQLite connection strings in SQLiteProjectCommandExecuter --- .../Services/SQLiteProjectCommandExecuter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs index bfd1d17c8..2cade2e14 100644 --- a/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs +++ b/src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs @@ -10,7 +10,7 @@ public class SQLiteProjectCommandExecuter public virtual void ExecuteCommand(string projectFile, Action command ) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SqliteConnection($"Data Source={file};Foreign Keys=True")) + using (var sqlLite = new SqliteConnection($"Data Source={file}")) { sqlLite.Open(); command(sqlLite); @@ -20,7 +20,7 @@ public virtual void ExecuteCommand(string projectFile, Action comm public virtual TResult ExecuteCommand(string projectFile, Func command) { string file = projectFile.ToUNCPath(); - using (var sqlLite = new SqliteConnection($"Data Source={file};Foreign Keys=True")) + using (var sqlLite = new SqliteConnection($"Data Source={file}")) { sqlLite.Open(); return command(sqlLite); From 815c115f72160713460f2d7428f71f8380cfb2bf Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Thu, 6 Nov 2025 09:40:12 +0100 Subject: [PATCH 12/12] Remove reference to Microsoft.Data.Sqlite from test project --- .../OSPSuite.Infrastructure.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index 9cef8c82e..612e7131d 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -17,7 +17,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive -