In a WPF app, I'm creating a connection to a local encrypted database (using Microsoft.Data.Sqlite):
string builder = new SqliteConnectionStringBuilder($"Data Source=source.sqlite; Password='{password}';")
{
Mode = SqliteOpenMode.ReadOnly
}.ToString();
Each query is wrapped in a using
block.
The problem is that after 5 to 10 minutes of inactivity on the app, SQLite seems to close the connection to the database as the next query takes as long as the first one (when opening the app, which is normal, I guess).
I tried playing with the parameters of the SqliteConnectionStringBuilder
such as Cache
or Pooling
, but no success.
Would it be possible to prevent this from happening?