コード例 #1
0
        /// <summary>
        /// A conflict has occured, we try to ask for the solution to the user
        /// </summary>
        internal (ApplyAction, DmRow) GetConflictAction(SyncConflict conflict, ConflictResolutionPolicy policy, DbConnection connection, DbTransaction transaction = null)
        {
            ConflictAction conflictAction = ConflictAction.ServerWins;

            if (policy == ConflictResolutionPolicy.ClientWins)
            {
                conflictAction = ConflictAction.ClientWins;
            }

            var arg = new ApplyChangeFailedEventArgs(conflict, conflictAction, connection, transaction);

            this.ApplyChangedFailed?.Invoke(this, arg);

            // if ConflictAction is ServerWins or MergeRow it's Ok to set to Continue
            ApplyAction action = ApplyAction.Continue;

            if (arg.Action == ConflictAction.ClientWins)
            {
                action = ApplyAction.RetryWithForceWrite;
            }

            DmRow finalRow = arg.Action == ConflictAction.MergeRow ? arg.FinalRow : null;

            // returning the action to take, and actually the finalRow if action is set to Merge
            return(action, finalRow);
        }
コード例 #2
0
 private void RemoteProvider_ApplyChangedFailed(object sender, ApplyChangeFailedEventArgs e) => this.ApplyChangedFailed?.Invoke(this, e);