Amazon.CognitoSync.SyncManager.Dataset.Resolve C# (CSharp) Method

Resolve() public method

Saves resolved conflicting Amazon.CognitoSync.SyncManager.Record into local storage. This is used inside SyncConflictDelegate after you resolve all conflicts.
public Resolve ( List remoteRecords ) : void
remoteRecords List A list of records to save into local storage
return void
        public void Resolve(List<Record> remoteRecords)
        {
            Local.PutRecords(IdentityId, DatasetName, remoteRecords);
        }

Usage Example

Example #1
0
    private static bool HandleSyncConflict(Amazon.CognitoSync.SyncManager.Dataset dataset, List <SyncConflict> conflicts)
    {
        if (dataset.Metadata != null)
        {
            Debug.LogWarning("Sync conflicct resolution required for dataset: " + dataset.Metadata.DatasetName);
        }
        else
        {
            Debug.LogWarning("Sync conflicct resolution required for dataset");
        }

        List <Amazon.CognitoSync.SyncManager.Record> resolvedRecords = new List <Amazon.CognitoSync.SyncManager.Record>();

        foreach (SyncConflict conflictRecord in conflicts)
        {
            // This example resolves all the conflicts using ResolveWithRemoteRecord
            // SyncManager provides the following default conflict resolution methods:
            //      ResolveWithRemoteRecord - overwrites the local with remote records
            //      ResolveWithLocalRecord - overwrites the remote with local records
            //      ResolveWithValue - for developer logic
            resolvedRecords.Add(conflictRecord.ResolveWithRemoteRecord());
        }

        // resolves the conflicts in local storage
        dataset.Resolve(resolvedRecords);

        // on return true the synchronize operation continues where it left,
        //      returning false cancels the synchronize operation

        AdvanceGameState();

        return(true);
    }
All Usage Examples Of Amazon.CognitoSync.SyncManager.Dataset::Resolve