Необходимо использовать VFS MemDB: "Data Source=file:/inmem-filename.db?vfs=memdb"
Пример:
var memortFile = $"file:/{Path.GetFileName(databaseFilename)}";
var memoryConnectionString = $"Data Source={memortFile}?vfs=memdb";
var memoryReadOnlyConnectionString = $"{memoryConnectionString};Mode=ReadOnly";
var fileBasedConnectionString = new SqliteConnectionStringBuilder()
{
DataSource = databaseFilename,
Mode = SqliteOpenMode.ReadOnly,
Pooling = true,
}.ConnectionString;
using (var inmemoryConnection = new SqliteConnection(memoryConnectionString))
{
inmemoryConnection.Open();
//Восстановить backup или SQLitePCL.raw.sqlite3_deserialize()
using (var connection = new SqliteConnection(fileBasedConnectionString))
{
connection.Open();
connection.BackupDatabase(inmemoryConnection);
}
StartConcurrentTest("IN MEM", threadsQuantities, memoryReadOnlyConnectionString);
}