[英]How can I run offline database usage in Blazor WebAssembly-PWA?
I have a Blazor WebAssembly ASP.NET Core hosted - PWA
application and wanna run it also offline.我有一个Blazor WebAssembly ASP.NET Core hosted - PWA
应用程序并想离线运行它。 The database is currently built with SQLite and EF-Core.该数据库目前使用 SQLite 和 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).我已经阅读了有关IndexedDB
的信息,但实际上并不知道如何将其实现到项目(客户端)中。 Or is there any NuGet Package for this support?或者是否有任何 NuGet Package 用于此支持?
The functionality I wann 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我创建了一个库,为应该完成这项工作的移动客户端提供双向离线同步: 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.我计划很快创建一个 blazor wasm 离线示例并在博客中介绍它。
You can try this package.你可以试试这个 package。 This is a Blazor library to work with IndexedDB DOM API这是一个 Blazor 库,可与 IndexedDB DOM API 一起使用
https://github.com/amuste/DnetIndexedDb 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.但是,如果您计划构建一个大型复杂系统,这是通往 go 的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.