Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Benefit of using SQLite with Blazor WASM?

I was watching this video from Steve Sanderson which demonstrates using SQLite with Blazor Web Assembly and I am contemplating using it in one of my projects. I am just trying to understand what the benefit is. It seems, from whatever information I was able to find, that the actual SQLite database resides in memory. In his project he is synchronizing it with IndexedDB for persistence. If that is the case, how is that better than storing your data as an object list in memory, and using Linq to query the objects directly, instead of Entity Framework to query from the SQLite database? You can also persist your objects to IndexedDB if that is required. I was never under the impression that it is a good idea to keep that much data in memory. My initial thought when seeing that you can use SQLite in Blazor was that it allowed you to keep data client side without keeping it all in memory. If that is not the case, what is the benefit of using SQLlite in a Blazor app?

like image 475
metsman Avatar asked Oct 26 '25 05:10

metsman


1 Answers

A good rule of programming is KISS - Keep it Simple. So if the requirement of your app is satisfied by Linq to Objects, then complicating it with SQLite would seem to be the wrong thing to do.

However, in the video Steve S. does come up with requirement parameters that lend themselves to using SQLite - the application needs to process:

  • lots of data
  • in the client
  • offline
  • quickly

The use of SQLite here is not for persisting beyond client app memory.

So the answer to your question on the advantage of a Blazor app using SQLite is simply:

  • If an app needs the functionality of an in-memory relational database but is trying to avoid using one, it will either be reinventing the wheel in its implementation, or missing necessary functionality.
  • If an app doesn't need the functionality of an in-memory database but is using one, it will be introducing unnecessary complexity (cost).
like image 185
user603563 Avatar answered Oct 28 '25 19:10

user603563