private void CreateKeyValues(Action <IDocumentCollection <KeyValueDocument> > operation) { string dirPath = directoryCreator.CreateSdkDirectory("KeyValues"); try { using (IDocumentCollection <KeyValueDocument> documentCollection = documentCollectionFactory.CreateHighSecurityFileSystemCollection <KeyValueDocument>(dirPath, encryptionKey)) { databaseCorruptionHandler.Add(documentCollection); operation(documentCollection); databaseCorruptionHandler.Remove(documentCollection); } } catch (CorruptionException ex) { databaseCorruptionHandler.HandleCorruption(ex); throw; } }
private AlertDocument GetAlertDocument(long alertId) { try { return((from id in alerts.FindDocumentIdsEqual(AlertDocument.AlertIdFieldName, alertId) select alerts.Find(id)).FirstOrDefault()); } catch (CorruptionException ex) { databaseCorruptionHandler.HandleCorruption(ex); throw; } }