I have a Blazor WebAssembly ASP.NET Core hosted - PWA
application and want to run it offline. The database is currently built with SQLite and EF-Core. Is it possible to add offline functionality? I have read about IndexedDB
but don't actually know how to implement that into the project (client-side). Or is there any NuGet Package for this support?
The functionality I want to bring into the project is - tracking local changes and fetching them to the DB when its online again.
I've created a library that provides bi-directional offline sync for mobile clients that should do the job: https://github.com/stefffdev/NubeSync
Especially handling conflict resolution when multiple clients did change a record can become tricky, so you could use that as a starting point.
I plan to create a blazor wasm offline sample and blog about it soon.
check This example, uses javascript to store locally in the browser
You can try this package. This is a Blazor library to work with IndexedDB DOM API
https://github.com/amuste/DnetIndexedDb
I'm using event sourcing to solve this problem. It deals well with syncing occasionally connected clients as described here. It means dropping entity framework and probably rearchitecting your entire persitance tech stack, so it is far from ideal. But if you plan on building a large complicated system, this is the way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With