/// <summary>
        /// Internal method called by the StoreConflict class during RejectChangesInternal to resolve a store conflict
        /// without locking the the save sync lock.  This ultimately filters down through CancelChanges, which locks,
        /// so this method does not need to.  When it does lock, it causes a deadlock.
        /// </summary>
        /// <param name="conflict"></param>
        /// <param name="resolutionAction"></param>
        internal void ResolveStoreConflictNoLock(StoreConflict conflict, StoreConflictResolutionAction resolutionAction)
        {
            // Cache the modified entity, which may disappear depending on the resolution
            IsolatedStorageOfflineEntity visibleEntity = conflict.ModifiedEntity;

            // Respond to the resolution
            if (resolutionAction == StoreConflictResolutionAction.AcceptModifiedEntity)
            {
                ((IsolatedStorageOfflineEntity)conflict.ModifiedEntity).UpdateModifiedTickCount();
            }
            else if (resolutionAction == StoreConflictResolutionAction.AcceptStoreEntity)
            {
                _cacheData.ResolveStoreConflictByRollback(conflict.ModifiedEntity);
            }
            else
            {
                throw new ArgumentException("Invalid resolution action specified");
            }

            // Cleanup pointers to conflicts everywhere.
            visibleEntity.StoreConflict = null;
            this._storeConflicts.Remove(conflict);

            // Clearing the context will prevent the resolution from being triggered again.
            conflict.ClearContext();
        }
 /// <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 ResolveStoreConflict(StoreConflict conflict, StoreConflictResolutionAction resolutionAction)
 {
     using (_saveSyncLock.LockObject())
     {
         ResolveStoreConflictNoLock(conflict, resolutionAction);
     }
 }
예제 #3
0
        /// <summary>
        /// Calls the context to resolve it.
        /// </summary>
        /// <param name="resolutionAction"></param>
        public void Resolve(StoreConflictResolutionAction resolutionAction)
        {
            if (_context == null)
            {
                throw new InvalidOperationException("Conflict has already been resolved");
            }

            _context.ResolveStoreConflict(this, resolutionAction);
        }
        /// <summary>
        /// Calls the context to resolve it.
        /// </summary>
        /// <param name="resolutionAction"></param>
        public void Resolve(StoreConflictResolutionAction resolutionAction)
        {
            if (_context == null)
            {
                throw new InvalidOperationException("Conflict has already been resolved");
            }

            _context.ResolveStoreConflict(this, resolutionAction);
        }
예제 #5
0
 /// <summary>
 /// Called internally to avoid a deadlock when CancelChanges is called on the
 /// context
 /// </summary>
 /// <param name="resolutionAction"></param>
 internal void ResolveInternal(StoreConflictResolutionAction resolutionAction)
 {
     _context.ResolveStoreConflictNoLock(this, resolutionAction);
 }
 /// <summary>
 /// Called internally to avoid a deadlock when CancelChanges is called on the
 /// context
 /// </summary>
 /// <param name="resolutionAction"></param>
 internal void ResolveInternal(StoreConflictResolutionAction resolutionAction)
 {
     _context.ResolveStoreConflictNoLock(this, resolutionAction);
 }