예제 #1
0
        public async Task UpdateProviderSourceDatasetHistory(IEnumerable <ProviderSourceDatasetHistory> providerSourceDatasets)
        {
            Guard.ArgumentNotNull(providerSourceDatasets, nameof(providerSourceDatasets));

            List <Task>   allTasks  = new List <Task>();
            SemaphoreSlim throttler = new SemaphoreSlim(initialCount: 15);

            foreach (ProviderSourceDatasetHistory dataset in providerSourceDatasets)
            {
                await throttler.WaitAsync();

                allTasks.Add(
                    Task.Run(async() =>
                {
                    try
                    {
                        await _cosmosRepository.CreateAsync(new KeyValuePair <string, ProviderSourceDatasetHistory>(dataset.ProviderId, dataset));
                    }
                    finally
                    {
                        throttler.Release();
                    }
                }));
            }
            await Task.WhenAll(allTasks);
        }
        public async Task SaveVersion(T newVersion, T currentVersion = null)
        {
            if (currentVersion == null)
            {
                newVersion.Version = 1;

                newVersion.PublishStatus = PublishStatus.Draft;
            }
            else
            {
                newVersion.Version = await GetNextVersionNumber(newVersion);

                switch (currentVersion.PublishStatus)
                {
                case PublishStatus.Draft:
                    newVersion.PublishStatus = PublishStatus.Draft;
                    break;

                case PublishStatus.Approved:
                    if (newVersion.PublishStatus == PublishStatus.Draft)
                    {
                        break;
                    }
                    else
                    {
                        newVersion.PublishStatus = PublishStatus.Updated;
                    }
                    break;

                default:
                    newVersion.PublishStatus = PublishStatus.Updated;
                    break;
                }
            }

            newVersion.Date = DateTimeOffset.Now.ToLocalTime();

            await _cosmosRepository.CreateAsync <T>(newVersion);
        }
예제 #3
0
 public Task <HttpStatusCode> SaveDefinitionSpecificationRelationship(DefinitionSpecificationRelationship relationship)
 {
     return(_cosmosRepository.CreateAsync(relationship));
 }
 public async Task CreateDatasetAggregations(DatasetAggregations datasetAggregations)
 {
     await _cosmosRepository.CreateAsync <DatasetAggregations>(datasetAggregations);
 }
예제 #5
0
 public async Task <HttpStatusCode> SaveJobDefinition(JobDefinition definition)
 {
     return(await _cosmosRepository.CreateAsync(definition));
 }
예제 #6
0
 public async Task <HttpStatusCode> CreateDraftCalculation(Calculation calculation)
 {
     return(await _cosmosRepository.CreateAsync(calculation));
 }
 public Task <HttpStatusCode> CreateBuildProject(BuildProject buildProject)
 {
     return(_cosmosRepository.CreateAsync(buildProject));
 }