DEV Community

Vico Biscotti
Vico Biscotti

Posted on

Finally Switching from Microsoft LocalDb to SQLite

Why didn't I do that before? I know, it doesn't make sense.
Well, for my new Windows app I wanted to stay in the Microsoft stack - as usual - and plans were about scaling up to SQL Server. Only option left nowadays, now that SQL Compact is deprecated and Access is not supported by Entity Framework, is Microsoft SQL Server Express LocalDb.
Yes, it's that bad. Microsoft forgot file-based databases for Windows apps.
Now, LocalDb comes with plenty of drawbacks. Let's recap just two of them.
First one is that it needs a separate setup. It's a Microsoft database... it's intended for small apps... and yet... you cannot embed it in your setup from Visual Studio. You need to handle a separate install - trying not to annoy your customers - and handle different setups/versions for different Windows versions. Just madness.
Second, SQL Server databases have versions. SQL Server Management Studio automatically upgrades databases, so you need to use an old version and be extremely careful, if you want previous version of Local Db to work.
More on on this mess on Databases for Windows Desktop Development: Welcome to the Jungle.
Well, despite all the universe telling me "don't use LocalDb," I released the 1.0 with LocalDb.
Later, I developed a twin Android app, and used SQLite for it. So, late-genius in me said: "time to try it for the desktop too."
And so did I.
Well, having it working it's not been fun as it's usually "advertised" but it finally worked perfectly. No performance improvements, but a huge improvement in terms of schema changes (no mess with database versions), smaller setup (127 Mb to 7 Mb) and... unique setup.
I feel so... light, now!

Discussion (0)