Exemple #1
0
        public async Task DeleteDatasetsBySpecificationId(string specificationId, DeletionType deletionType)
        {
            IEnumerable <Dataset> datasets = await GetDatasetsByQuery(d => d.Id == specificationId);

            List <Dataset> datasetList = datasets.ToList();

            if (!datasetList.Any())
            {
                return;
            }

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(datasets.Select(c => new KeyValuePair <string, Dataset>(null, c)), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                IEnumerable <DatasetVersion> datasetVersions = await GetDatasetVersionsByQuery(d => d.Id == specificationId);

                List <DatasetVersion> datasetVersionsList = datasetVersions.ToList();

                if (datasetVersionsList.Any())
                {
                    await _cosmosRepository.BulkDeleteAsync(datasetVersions.Select(c => new KeyValuePair <string, DatasetVersion>(null, c)), hardDelete : true);
                }

                await _cosmosRepository.BulkDeleteAsync(datasets.Select(c => new KeyValuePair <string, Dataset>(null, c)), hardDelete : true);
            }
        }
Exemple #2
0
        public async Task DeleteCurrentProviderSourceDatasets(IEnumerable <ProviderSourceDataset> providerSourceDatasets)
        {
            Guard.ArgumentNotNull(providerSourceDatasets, nameof(providerSourceDatasets));

            await _cosmosRepository.BulkDeleteAsync <ProviderSourceDataset>(
                providerSourceDatasets.Select(x => new KeyValuePair <string, ProviderSourceDataset>(x.ProviderId, x)),
                degreeOfParallelism : 15);
        }
Exemple #3
0
        internal async Task DeleteDocuments <T>(IEnumerable <KeyValuePair <string, T> > documents, string containerName) where T : IIdentifiable
        {
            _cosmosDbSettings.ContainerName = containerName;

            ICosmosRepository cosmosRepository = new CosmosRepository(_cosmosDbSettings);

            await cosmosRepository
            .BulkDeleteAsync(documents, degreeOfParallelism : 15, hardDelete : true);
        }