I have tried SQLiteConnection(":memory:")
and SQLiteConnection("sqlite::memory:")
but both of these fail with 'Invalid ConnectionString format'
SQLite in-memory databases are databases stored entirely in memory, not on disk. Use the special data source filename :memory: to create an in-memory database. When the connection is closed, the database is deleted.
Use create inmemory database to create an in-memory database, using model or another user database as its template. You can also create temporary databases as in-memory databases that reside entirely in in-memory storage. However, you cannot specify a template database for an in-memory temporary database.
In SQLite, sqlite3 command is used to create a new SQLite database.
It means that each time you query a database or update data in a database, you only access the main memory. So, there's no disk involved into these operations. And this is good, because the main memory is way faster than any disk. A good example of such a database is Memcached.
try
var connection = new SQLiteConnection("Data Source=:memory:");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With