2 in-memory Sqlite databases

Is it possible to create two, in-memory Sqlite databases? If so, how?

Sqlite supports this. As per their documentation:

If two or more distinct but shareable in-memory databases are needed in a single process, then the mode=memory query parameter can be used with a URI filename to create a named in-memory database:

> rc = sqlite3_open(“file:memdb1?mode=memory&cache=shared”, &db);
> ATTACH DATABASE ‘file:memdb1?mode=memory&cache=shared’ AS aux1;

Not with OrmLite which only includes special support for creating SQLite in memory databases with the “:memory:” connection string identifier where it will keep & recycle the open connection to prevent the in memory database from being destroyed.

I’ve never heard of this being used anywhere so I’m not sure if it’s even possible using the underlying System.Data.SQLite.SQLiteConnection or Microsoft.Data.Sqlite.SqliteConnection ADO .NET Connection classes directly or whether you’d need to use something like sqlite-net which exports public APIs that let you access SQLite’s native APIs directly.

Thanks Demis. I will look into sqlite-net or come up with a different approach.