/// <summary> /// Deletes the synchronization record belonging to the current gallery. When a sync is initiated it will be created. /// </summary> private void ConfigureSyncTable() { using (var repo = new SynchronizeRepository()) { var syncDto = repo.Find(GalleryId); if (syncDto != null) { repo.Delete(syncDto); repo.Save(); } } }
/// <summary> /// Deletes the synchronization record belonging to the current gallery, but only when it's in an invalid state. /// When a sync is initiated it will be created. /// </summary> private void ConfigureSyncTable() { // It is very important to preserve the sync row if the state is InterruptedByAppRecycle! var syncStatesToDelete = new[] { SynchronizationState.SynchronizingFiles, SynchronizationState.PersistingToDataStore }; using (var repo = new SynchronizeRepository()) { var syncDto = repo.Where(s => s.FKGalleryId == GalleryId && syncStatesToDelete.Contains(s.SynchState)).FirstOrDefault(); if (syncDto != null) { repo.Delete(syncDto); repo.Save(); } } }