public async Task DeleteCurrentTestScenarioTestResults(IEnumerable <TestScenarioResult> testScenarioResults)
        {
            Guard.ArgumentNotNull(testScenarioResults, nameof(testScenarioResults));

            await _cosmosRepository.BulkDeleteAsync <TestScenarioResult>(
                entities : testScenarioResults.Select(x => new KeyValuePair <string, TestScenarioResult>(x.Provider.Id, x)),
                degreeOfParallelism : 15,
                hardDelete : true
                );
        }
        public async Task DeleteCurrentProviderResults(IEnumerable <ProviderResult> providerResults)
        {
            Guard.ArgumentNotNull(providerResults, nameof(providerResults));

            await _cosmosRepository.BulkDeleteAsync <ProviderResult>(
                providerResults.Select(x => new KeyValuePair <string, ProviderResult>(x.Provider.Id, x)),
                degreeOfParallelism : 15,
                hardDelete : true);
        }
        public async Task DeleteCalculationsBySpecificationId(string specificationId, DeletionType deletionType)
        {
            IEnumerable <Calculation> calculations = await GetCalculationsBySpecificationId(specificationId);

            List <Calculation> existingCalculations = calculations.ToList();

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

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(existingCalculations.Select(c => new KeyValuePair <string, Calculation>(null, c)), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(existingCalculations.Select(c => new KeyValuePair <string, Calculation>(null, c)), hardDelete : true);
            }
        }
        public async Task DeleteJobsBySpecificationId(string specificationId, DeletionType deletionType)
        {
            IEnumerable <Job> jobs = await GetJobsBySpecificationId(specificationId);

            List <Job> jobsList = jobs.ToList();

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

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(jobsList.ToDictionary(c => c.Id), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(jobsList.ToDictionary(c => c.Id), hardDelete : true);
            }
        }
Beispiel #5
0
        public async Task DeleteCalculationResultsBySpecificationId(string specificationId, DeletionType deletionType)
        {
            IEnumerable <ProviderResult> calculationResults = await GetCalculationResultsBySpecificationId(specificationId);

            List <ProviderResult> calculationResultList = calculationResults.ToList();

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

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(calculationResultList.ToDictionary(c => c.Provider.Id), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(calculationResultList.ToDictionary(c => c.Provider.Id), hardDelete : true);
            }
        }
        public async Task DeleteProviderSourceDataset(string providerSourceDatasetId, DeletionType deletionType)
        {
            IEnumerable <ProviderSourceDataset> providerSourceDatasets =
                await _cosmosRepository.Query <ProviderSourceDataset>(m => m.Id == providerSourceDatasetId);

            List <ProviderSourceDataset> providerSourceDatasetList = providerSourceDatasets.ToList();

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

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(providerSourceDatasetList.ToDictionary(c => c.ProviderId), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(providerSourceDatasetList.ToDictionary(c => c.ProviderId), hardDelete : true);
            }
        }
Beispiel #7
0
        public async Task DeleteTestsBySpecificationId(string specificationId, DeletionType deletionType)
        {
            IEnumerable <TestScenario> testResults = await GetTestsBySpecificationId(specificationId);

            IEnumerable <TestScenario> tests = await GetTestsBySpecificationId(specificationId);

            List <TestScenario> allTests = tests.ToList();

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

            if (deletionType == DeletionType.SoftDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(allTests.ToDictionary(c => c.Id), hardDelete : false);
            }
            if (deletionType == DeletionType.PermanentDelete)
            {
                await _cosmosRepository.BulkDeleteAsync(allTests.ToDictionary(c => c.Id), hardDelete : true);
            }
        }
Beispiel #8
0
        public async Task DeleteCurrentProviderSourceDatasets(IEnumerable <ProviderSourceDataset> providerSourceDatasets)
        {
            Guard.ArgumentNotNull(providerSourceDatasets, nameof(providerSourceDatasets));

            //keep getting a bad request when I use this delete path with allow bulk set to true so reverted to existing bulk delete method for now

            // Task<HttpStatusCode>[] deleteTasks = providerSourceDatasets
            //     .Select(providerSourceDataset => _cosmosRepository.DeleteAsync<ProviderSourceDataset>(providerSourceDataset.Id, providerSourceDataset.ProviderId, true))
            //     .ToArray();
            //
            // await TaskHelper.WhenAllAndThrow(deleteTasks);

            await _cosmosRepository.BulkDeleteAsync(providerSourceDatasets.Select(_ => new KeyValuePair <string, ProviderSourceDataset>(_.ProviderId, _)));
        }
        public async Task DeleteSpecifications(string specificationId, DeletionType deletionType)
        {
            if (deletionType == DeletionType.SoftDelete)
            {
                await _repository.DeleteAsync <Specification>(specificationId, null, hardDelete : false);
            }
            else if (deletionType == DeletionType.PermanentDelete)
            {
                IEnumerable <SpecificationVersion> specifications =
                    await _repository.Query <SpecificationVersion>(m => m.Content.SpecificationId == specificationId);

                List <SpecificationVersion> specificationsList = specifications.ToList();

                if (specificationsList.Any())
                {
                    await _repository.BulkDeleteAsync(specificationsList.Select(_ => new KeyValuePair <string, SpecificationVersion>(null, _)), hardDelete : true);
                }

                await _repository.DeleteAsync <Specification>(specificationId, null, hardDelete : true);
            }
        }
Beispiel #10
0
 public async Task DeleteVersions(IEnumerable <KeyValuePair <string, T> > newVersions, int maxDegreesOfParallelism = 30)
 {
     Guard.ArgumentNotNull(newVersions, nameof(newVersions));
     await CosmosRepository.BulkDeleteAsync(newVersions.ToList(), degreeOfParallelism : maxDegreesOfParallelism);
 }