/// <summary> /// Create and Get Table /// </summary> /// <returns></returns> public static async Task CreateAndGetTable() { CloudStorageAccount storageAccount = GetCloudStorageAccount.CreateStorageAccount(); string currentTableName = TableName + DateTime.Now.ToString("yyyyMMddhhmmss").ToString(); //string currentTableName = "testtable20151225090911"; tableStorage = new TableStorage <CustomerEntity>(storageAccount, currentTableName); List <CustomerEntity> insertEntityList = InsertDataCount.CreateCustomerEntity(); await tableStorage.CreateEntities(insertEntityList); List <CustomerEntity> getTableResult = new List <CustomerEntity>(); getTableResult = tableStorage.GetEntitiesByPartitionKey("Jonathan").Result.ToList(); if (getTableResult.Count == insertEntityList.Count && insertEntityList.Count == GetSameEntities(getTableResult, insertEntityList).Count()) { Log.Info("GetEntitiesByPartitionKey from Table Success, Count:{0}", getTableResult.Count); } else { Log.Error("GetEntitiesByPartitionKey from Table Fail, Expect Count:{0}, Actual Count{1}, table name:{2}", insertEntityList.Count, getTableResult.Count, currentTableName); } getTableResult = new List <CustomerEntity>(); getTableResult = tableStorage.GetEntitiesByRowKeyAsync( InsertDataCount.StartRowKey(), InsertDataCount.EndRowKey()).Result.ToList(); if (getTableResult.Count == takeCount && takeCount == GetSameEntities(getTableResult, insertEntityList).Count()) { Log.Info("GetEntitiesByRowKey from Table Success, Count:{0}", getTableResult.Count); //tableStorage.DeleteTable(); } else { Log.Error("GetEntitiesByRowKey from Table Fail, Expect Count:{0}, Actual Count:{1}, table name:{2}", insertEntityList.Count, getTableResult.Count, currentTableName); } }