Offline DB (SQLite) with Blazor WASM

Prathamesh Shende 441 Reputation points
2021-12-31T15:18:47.843+00:00

I have seen so many web app that supports offline. Like IF internet is not available but still use can post and update data into webapp
and then move to online database sql after webapp goes online.

Can we implement this Blazor WASM connect sqlite or with IndexedDB and post offline changes to online database?

Developer technologies .NET Blazor
SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Washington 921 Reputation points MVP
    2021-12-31T15:24:49.767+00:00

    This example does just that:
    CarChecker - a Blazor sample app

    There is a video where he explains how it works on Channel 9: Modern Web UI with Blazor WebAssembly


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-12-31T16:52:28.117+00:00

    The sample blazor app uses local storage via JavaScript interop for offline support. But it requires the app to be running to do the upload.

    A more common approach is to use a service worker that does the upload in the background, so the app does not need to be running. A service worker can also cache requests, so you can keep all the logic in one place. As blazor httpclient uses JavaScript interop to fetch data, it works perfectly with service workers.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.