json-flatfile-datastore
json-flatfile-datastore copied to clipboard
[Suggestion] Supporting acting as a local datastore in Blazor Wasm (Client Side)
Currently this is storing data inside a single json file, taking this into consideration would it be possible to make this store into the browser local storage to be used as a client side datastore for blazor webassembly? Thanks!
Thanks! This is an interesting idea.
I haven't done any Blazor development, so I'm not immediately sure if this could be implemented easily. However, it might not be a big implementation. Internally, JsonFlatFileDataStore only handles JSON objects, and actual file access is only a minor functionality. If we switch from reading and storing JSON from a file to local storage, that might do the trick.
The current file access implementation: https://github.com/ttu/json-flatfile-datastore/blob/master/JsonFlatFileDataStore/FileAccess.cs
If I have some time, I will do some proof of concept and try it out. If anyone else has time to check how this could be implemented, I would appreciate some feedback.
I had time to prototype local storage support.
This will require 3 tasks:
- [ ] Add support to switch storage implementation https://github.com/ttu/json-flatfile-datastore/compare/master...106-save-json-to-local-storage
- [ ] Change support from netstandard 2.0 to 2.1 to be able to use System.IO.File async write and read operations which also local storage uses
- [ ] Release Blazor local storage implementation in a separate NuGet package
Thanks! I've forked the repo again, I'll try to see if I can get an implementation done