Ejemplo n.º 1
0
        /// <summary>
        /// Internal method called by the StoreConflict class in order to resolve a store conflict.  This must be done
        /// because there must be some maintenance of the in-memory collections depending on the resolution of the conflict
        /// </summary>
        /// <param name="conflict">Conflict to resolve</param>
        /// <param name="resolutionAction">Resolution action.</param>
        internal void ResolveOfflineConflict(OfflineConflict conflict, SyncConflictResolutionAction resolutionAction)
        {
            using (saveSyncLock.LockObject())
            {
                // Cache the modified entity, which may disappear depending on the resolution
                OfflineEntity visibleEntity = conflict.ModifiedEntity;

                // Respond to the resolution
                switch (resolutionAction)
                {
                case SyncConflictResolutionAction.AcceptModifiedEntity:
                    conflict.ModifiedEntity.UpdateModifiedTickCount();
                    break;

                case SyncConflictResolutionAction.AcceptStoreEntity:
                    cacheData.ResolveStoreConflictByRollback(conflict.ModifiedEntity);
                    break;

                default:
                    throw new ArgumentException("Invalid resolution action specified");
                }

                // Cleanup pointers to conflicts everywhere.
                visibleEntity.OfflineConflict = null;
                offlineConflicts.Remove(conflict);

                // Clearing the c will prevent the resolution from being triggered again.
                conflict.ClearContext();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calls the context to resolve it.
        /// </summary>
        /// <param name="resolutionAction"></param>
        public void Resolve(SyncConflictResolutionAction resolutionAction)
        {
            if (context == null)
                throw new InvalidOperationException("Conflict has already been resolved");

            context.ResolveOfflineConflict(this, resolutionAction);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calls the context to resolve it.
        /// </summary>
        /// <param name="resolutionAction"></param>
        public void Resolve(SyncConflictResolutionAction resolutionAction)
        {
            if (context == null)
            {
                throw new InvalidOperationException("Conflict has already been resolved");
            }

            context.ResolveOfflineConflict(this, resolutionAction);
        }