简体   繁体   English

如何在 Blazor WebAssembly-PWA 中运行离线数据库使用?

[英]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.

相关问题 如何将 Blazor WebAssembly 连接到数据库 - How to connect Blazor WebAssembly to DataBase 如何在 Blazor WebAssembly 中登录时运行代码? - How to run code on login in Blazor WebAssembly? Blazor WebAssembly PWA - IFormFile FromForm 始终为 null - Blazor WebAssembly PWA - IFormFile FromForm is always null 如何从 Blazor WebAssembly 中的 Razor Page 访问 body 标签或其他标签? - How can I reach body tag or another tag from Razor Page in Blazor WebAssembly? 如何在 Blazor WebAssembly 中获取 static 图像文件的文件路径列表? - How can I get a list of file paths for static image files in Blazor WebAssembly? 如何在 C# Blazor WebAssembly 中使用引导图标? - How do I use Bootstrap Icons in C# Blazor WebAssembly? 如何在 Blazor WebAssembly 中的 Session 中存储敏感数据 - how can store Sensitive data in Session in Blazor WebAssembly 如何将 Blazor Serverside 与 Blazor WebAssembly 结合使用? - How to use Blazor Serverside with Blazor WebAssembly? 如何访问 blazor webassembly 中的应用程序设置 - How to acess the appsettings in blazor webassembly 在组件中的 Blazor WebAssembly 中,假设文化是正确的,如何使 DateTime.ToString 使用当前文化的日期格式? - In Blazor WebAssembly in a component, how can I make DateTime.ToString use the date format of the current culture, assuming the culture is correct?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM