json-flatfile-datastore icon indicating copy to clipboard operation
json-flatfile-datastore copied to clipboard

[Suggestion] Supporting acting as a local datastore in Blazor Wasm (Client Side)

Open russkyc opened this issue 1 year ago • 3 comments

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!

russkyc avatar Nov 22 '24 02:11 russkyc

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.

ttu avatar Nov 24 '24 09:11 ttu

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

ttu avatar Feb 16 '25 09:02 ttu

Thanks! I've forked the repo again, I'll try to see if I can get an implementation done

russkyc avatar Feb 21 '25 06:02 russkyc