Class RecoverUnsyncedChangesHandler
A client reset strategy that attempts to automatically recover any unsynchronized changes.
Namespace: Realms.Sync.ErrorHandling
Assembly: Realm.dll
Syntax
public sealed class RecoverUnsyncedChangesHandler : ClientResetHandlerBase
Remarks
You can read more about the automatic merge rules at Client Resets - .NET SDK. The automatic recovery mechanism creates write transactions meaning that all the changes that take place are properly propagated through the standard Realm's change notifications. The RecoverUnsyncedChangesHandler strategy supplies three callbacks: OnBeforeReset, OnAfterReset and ManualResetFallback. The first two are invoked just before and after the client reset has happened, while the last one is invoked in case an error occurs during the automated process and the system needs to fallback to a manual mode. The overall recommendation for using this strategy is that using the three available callbacks should only be considered when:
- The user needs to be notified (in OnBeforeReset) of an incoming potential data loss of unsynced data as a result of a merge or a complete discard of local changes
- The user needs to be notified (in OnAfterReset) that the reset process has completed
- Advanced use cases for data-sensitive applications where the developer wants to recover in the most appropriate way the unsynced data
- Backup the whole realm before the client reset happens (in OnBeforeReset). Such backup could, for example, be used to restore the unsynced data (see 3.)
Properties
| Edit this page View SourceManualResetFallback
Gets or sets the callback triggered when an error has occurred that makes the operation unable to complete, for example in the case of a destructive schema change.
Declaration
public ClientResetHandlerBase.ClientResetCallback? ManualResetFallback { get; set; }
Property Value
Type | Description |
---|---|
ClientResetHandlerBase.ClientResetCallback | Callback invoked if automatic Client Reset handling fails. |
OnAfterReset
Gets or sets the callback that indicates a Client Reset just happened.
Declaration
public ClientResetHandlerBase.AfterResetCallback? OnAfterReset { get; set; }
Property Value
Type | Description |
---|---|
ClientResetHandlerBase.AfterResetCallback | Callback invoked right after a Client Reset. |
OnBeforeReset
Gets or sets the callback that indicates a Client Reset is about to happen.
Declaration
public ClientResetHandlerBase.BeforeResetCallback? OnBeforeReset { get; set; }
Property Value
Type | Description |
---|---|
ClientResetHandlerBase.BeforeResetCallback | Callback invoked right before a Client Reset. |