public void DeleteDocument <T>(string documentId) { _innerDocumentDbService.DeleteDocument <T>(documentId); _eventService.RaiseAsync(new EntityDeletedAuditEvent <T>(_userResolveService.Username, _userResolveService.ClientId, _userResolveService.Subject, documentId, _serializationSettings)) .ConfigureAwait(false); }
public async Task DeleteDocument <T>(string documentId) { await _eventService.RaiseEventAsync(new EntityAuditEvent <T>(EventTypes.EntityDeletedEvent, documentId)) .ConfigureAwait(false); await _innerDocumentDbService.DeleteDocument <T>(documentId); }
public async Task DeleteDocument <T>(string documentId) { var fullDocumentId = DocumentDbHelpers.GetFullDocumentId <T>(documentId); if (_cache.TryGetValue(fullDocumentId, out var document)) { _cache.Remove(fullDocumentId); } await _innerDocumentDbService.DeleteDocument <T>(documentId); }
public virtual async Task Delete(string id, T model) { model.Track(false, GetActor()); if (model is ISoftDelete) { (model as ISoftDelete).IsDeleted = true; await Update(model).ConfigureAwait(false); } else { _logger.Information($"Hard deleting {model.GetType()} {model.Identifier}"); await _dbService.DeleteDocument <T>(id).ConfigureAwait(false); } }
/// <summary> /// Deletes Blob and Document entity. /// </summary> /// <param name="document">Document entity to delete.</param> /// <param name="storageService">IStorageService.</param> /// <param name="docDbService">IDocDbService.</param> /// <param name="logger">Logger.</param> /// <returns></returns> public static async Task DeleteDocumentAndResources(Document document, IStorageService storageService, IDocumentDbService docDbService, ILogger logger) { Contract.Requires(storageService != null, nameof(storageService)); Contract.Requires(docDbService != null, nameof(docDbService)); if (document == null) { throw new BrowseCloudServiceException("Cannot delete a null document."); } await RetryHelper.RetryTask(storageService.DeleteContainer(StorageAccount.Training, document.Id.ToString())); logger.LogInformation($"Deleted training data container for document {document.Id.ToString()}."); await RetryHelper.RetryTask(docDbService.DeleteDocument <Document>(document.Id.ToString())); logger.LogInformation($"Deleted DocumentDB entity for document {document.Id.ToString()}."); }
/// <summary> /// Delete job and model files. /// </summary> /// <param name="job">Job to delete.</param> /// <param name="docDbService">IDocDbService.</param> /// <param name="storageService">IStorageService.</param> /// <param name="batchService">Azure Batch Service</param> /// <param name="logger">Logger</param> /// <returns></returns> public static async Task DeleteJobAndResources(BatchJob job, IDocumentDbService docDbService, IStorageService storageService, IBatchService batchService, ILogger logger) { Contract.Requires(docDbService != null, nameof(docDbService)); Contract.Requires(storageService != null, nameof(storageService)); Contract.Requires(batchService != null, nameof(batchService)); Contract.Requires(job != null, nameof(job)); await RetryHelper.RetryTask(batchService.TerminateTask(job.Id.ToString())); logger.LogInformation($"Terminated batch job task for job {job.Id.ToString()}."); await RetryHelper.RetryTask(storageService.DeleteContainer(StorageAccount.Model, job.Id.ToString())); logger.LogInformation($"Deleted model data container for job {job.Id.ToString()}."); await RetryHelper.RetryTask(docDbService.DeleteDocument <BatchJob>(job.Id.ToString())); logger.LogInformation($"Deleted DocumentDB entity for job {job.Id.ToString()}."); }
public Task RemoveAsync(string key) { _documentDbService.DeleteDocument <PersistedGrant>(key); return(Task.FromResult(0)); }
public void DeleteClient(string id) { _documentDbService.DeleteDocument <Client>(id); }