What I want to do is something along the lines of the following:
using System.Data.SQLite;
using System.IO;
//My SQLite connection
SQLiteConnection myCon;
public void ReadAndOpenDB(string filename)
{
FileStream fstrm = new FileStream(filename, FileMode.Open);
byte[] buf = new byte[fstrm.Length];
fstrm.Read(buf, 0, (int)fstrm.Length);
MemoryStream mstrm = new MemoryStream(buf);
//Do some things with the memory stream
myCon = new SQLiteConnection(/*attach to my memory stream for reading*/);
myCon.Open();
//Do necessary DB operations
}
I do not plan on writing to the in-memory DB, but I need to be able to do some things with the file, in memory in my program, before connecting to it.