parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
322 stars 260 forks source link

How to implement offline storage? #360

Open P99 opened 2 years ago

P99 commented 2 years ago

I am testing the Parse SDK for .NET it is awesome.

I would like to implement a data store similar to the other SDKs so that my application can work seamlessly offline. For instance, the Android SDK has Parse.enableLocalDatastore() ParseObject.pinInBackground() and ParseQuery.fromLocalDatastore() Can you provide some pointers how to start implementing that? Maybe it was already done somehow? I could not find any info in the documentation.

Thanks,

mtrezza commented 2 years ago

I could imagine that @cbaker6 may have some design clues, since he has been recently designing the Swift SDK and has probably looked into the pros/cons of the existing designs.

cbaker6 commented 2 years ago

I advise against implementing local storage like the other SDKs. The approach I recommend on taking is protocol based allowing developers to add their own local storage. More information is here: https://github.com/parse-community/Parse-Swift/projects/2#card-53117524

Parse-Swift doesn’t have local storage, but I link to an example implementation that uses Parse-Swift with CoreData (sql-lite) to properly keep data in-sync in on/offline scenarios

Of course, if you want to implement it like the other SDKs, I believe the JS SDK has the latest implementation https://github.com/parse-community/Parse-SDK-JS/pull/612 , fixes after adding LDS, https://github.com/parse-community/Parse-SDK-JS/pulls?q=is%3Apr+is%3Aclosed+LDs