public async Task <IProjectParticipateData> DeleteAsync(string projectId, string userId) { var partitionKey = ProjectParticipateEntity.GeneratePartitionKey(projectId); var rowKey = ProjectParticipateEntity.GenerateRowKey(userId); return(await _projectParticipateTableStorage.DeleteAsync(partitionKey, rowKey)); }
public static async Task <T> DeleteAsync <T>(this IAzureTableStorage <AzureIndex> indexTableStorage, string indexPartitionKey, string indexRowKey, IAzureTableStorage <T> tableStorage) where T : class, ITableEntity, new() { var indexEntity = await indexTableStorage.DeleteAsync(indexPartitionKey, indexRowKey); if (indexEntity == null) { return(null); } return(await tableStorage.DeleteAsync(indexEntity.PrimaryPartitionKey, indexEntity.PrimaryRowKey)); }
public async Task Upload() { var existingSearchTerms = (await _tableStorage.GetAllAsync <GlobalSearchTerm>("searchTerms")).ToList(); var i = 1; Parallel.ForEach(existingSearchTerms, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, async existingSearchTerm => { await _tableStorage.DeleteAsync("searchTerms", existingSearchTerm); Console.WriteLine($"Deleted {i} of {existingSearchTerms.Count} existing search terms."); i++; }); foreach (var globalSearchTerm in _globalSearchTermRepository.SearchTerms) { globalSearchTerm.LanguageEnum = _localization.Language; } await _tableStorage.AddBatchAsync <GlobalSearchTerm>("searchTerms", _globalSearchTermRepository.SearchTerms.Where(s => s.PartitionKey == ContentType.ExpandedContent.ToString()), new BatchOperationOptions { BatchInsertMethod = BatchInsertMethod.Insert }); await _tableStorage.AddBatchAsync <GlobalSearchTerm>("searchTerms", _globalSearchTermRepository.SearchTerms.Where(s => s.PartitionKey == ContentType.Core.ToString()), new BatchOperationOptions { BatchInsertMethod = BatchInsertMethod.Insert }); var index = await _searchIndexClient.GetIndexAsync("searchterms-index"); await _searchIndexClient.DeleteIndexAsync("searchterms-index"); await _searchIndexClient.CreateIndexAsync(index); var oldIndexer = await _searchIndexerClient.GetIndexerAsync("searchterms-indexer"); await _searchIndexerClient.DeleteIndexerAsync(oldIndexer); await _searchIndexerClient.CreateIndexerAsync(oldIndexer); await _searchIndexerClient.RunIndexerAsync("searchterms-indexer"); }
public static Task <T> DeleteAsync <T>(this IAzureTableStorage <T> tableStorage, IAzureIndex index) where T : ITableEntity, new() { return(tableStorage.DeleteAsync(index.PrimaryPartitionKey, index.PrimaryRowKey)); }