hanssens / localstorage

LocalStorage for .NET - A simple and lightweight tool for persisting data in dotnet (core) apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How's this work under the hood? I thought it actually wrote to localStorage...

timb33 opened this issue · comments

commented

How's this work under the hood? I thought it actually wrote to localStorage but I re-read https://hanssens.com/tag/csharp/
LocalStorage for .NET is inspired by – but totally unrelated to – Javascript’s localStorage; a temporary caching lib for low-demanding data needs. and apparently it's "inspired by" localStorage. So, is it doing the same thing via e.g. cookies?

Thanks,

I think that it works on server side storage not client side. as I deployed an app using LocalStorage package and I added data through a computer, When I checked the app through my mobile I found the data I entered through the computer.

So I think it is stored some where in the server-side.

No, it's basically a simple, embedded in-memory data store. It has absolutely nothing to do with the browser at all, other than that I was inspired by it's API on it. In short:

LocalStorage for .NET is inspired by – but totally unrelated to – Javascript’s localStorage; a temporary caching lib for low-demanding data needs.

I understand the confusion and will make it more clearly in the README.

Thank you @hanssens for your clarification. But I have more question regarding how it works, In the config parameter for Local storage there is persist option which I think it should save the data in a file called .localstorage by default.

But I can't actually find where is this file located in the system, I checked project bin folder and browser's caches and I can't find the file. Can you please clarify where can I find the persisted file?

Thank you.

That's actually a new question @Raamyy. May I ask you next time to please create and open a new issue for this?

That aside, you're right: by default a .localstorage file will be created in the project (executing assembly's) root folder. In the fresh [released v2.1.0] I've added some additional tests which assert and explain a bit more about this. With the LocalStorageConfigruation you can optionally provide a filename of your own choice.

However on both Windows as well as macOS files that start with a "." (e.g. has an extension, but no filename like .localstorage) are hidden by default in Explorer and Finder. Thinking out loud, but perhaps your system settings have these files hidden and therefor you can't find them?

Please note I'll close this issue now. The original question by @timb33 has been explained in a README section now. Hope that helped.