Question
How do I create an in-memory database with SQL CE 4.0?
Context
I'd like to do some unit testing (or automated integration testing) with a real database, however, one that is in-memory. That'll make the tests run fast, plus, the database will vanish in thin air once the test are finished running.
According to Scott Guthrie's blog post "VS 2010 SP1 and SQL CE" the new SQL CE 4.0 is capable of doing just that: providing an in-memory database.
However, I couldn't find any tutorials or code examples on the web showing how it is done. I only found this connection string example in this blog post. But that also hits the harddrive.
SQL Server CE 4.0 does not allow for memory-only databases.
That blog posts says that CE runs in-memory of your application.
A comment by Scott says that CE maps the file into memory, but that still requires the file.