protected void GetNames(GoogleVisualizationDataTable dataTable, Dictionary <string, int> tableIndex) { int index = 1; bool addDate = true; TableOperation tableOperation = TableOperation.Retrieve <DynamicTableEntity>("Setting", "Name"); CloudTableClient tableClient = AzureStorageExtension.GetCloudTableClient(AzureStorageConfig); string table0 = string.Format("{0}0", AzureStorageConfig.Container); TableContinuationToken token = new TableContinuationToken(); do { var orphanedTables = tableClient.ListTablesSegmentedAsync(AzureStorageConfig.Container, token).Result; token = orphanedTables.ContinuationToken; foreach (CloudTable cloudTable in orphanedTables.Results) { if (cloudTable.Name == table0) { continue; } DynamicTableEntity tdsTableEntity = (DynamicTableEntity)cloudTable.ExecuteAsync(tableOperation).Result.Result; IDictionary <string, EntityProperty> nameInfos = tdsTableEntity.Properties; string name = ""; foreach (KeyValuePair <string, EntityProperty> pInfo in nameInfos) { if (pInfo.Key != "PartitionKey" && pInfo.Key != "RowKey" && pInfo.Key != "Timestamp") { name = pInfo.Value.StringValue; //.GetValue(tdsTableEntity); if (name == null) { break; } if (pInfo.Key == "ADATE") { if (addDate) { dataTable.AddColumn(name, "datetime"); tableIndex.Add(pInfo.Key, 0); addDate = false; } } else { dataTable.AddColumn(name, "number"); tableIndex.Add(pInfo.Key, index++); } } } } }while (token != null); }
public CloudTable GetTable(int index) { CloudTableClient tableClient = AzureStorageExtension.GetCloudTableClient(AzureStorageConfig); string str = string.Format("{0}{1}", AzureStorageConfig.Container, index); CloudTable table = tableClient.GetTableReference(str); table.CreateIfNotExistsAsync().Wait(); while (table.ExistsAsync().Result != true) { } return(table); }
public void DataClear() { CloudTableClient tableClient = AzureStorageExtension.GetCloudTableClient(AzureStorageConfig); TableContinuationToken token = new TableContinuationToken(); do { var orphanedTables = tableClient.ListTablesSegmentedAsync(AzureStorageConfig.Container, token).Result; token = orphanedTables.ContinuationToken; foreach (CloudTable orphanedTableName in orphanedTables.Results) { orphanedTableName.DeleteAsync(); while (orphanedTableName.ExistsAsync().Result == true) { } } }while (token != null); Thread.Sleep(50000); }