コード例 #1
0
        /// <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();
        }
コード例 #2
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 ResolveStoreConflict(StoreConflict conflict, StoreConflictResolutionAction resolutionAction)
 {
     using (_saveSyncLock.LockObject())
     {
         ResolveStoreConflictNoLock(conflict, resolutionAction);
     }
 }