Example #1
0
        public static void QueryBatchOfPeople(IEnumerable <Person> batchToQuery)
        {
            CloudTable cloudTable = AzureUtils.GetCloudTable(Parameters.TableName);

            Parallel.ForEach(batchToQuery, (person) =>
            {
                TableOperation retrieveOperation = TableOperation.Retrieve <Person>(person.PartitionKey, person.RowKey);

                var queryTask = cloudTable.ExecuteAsync(retrieveOperation);
            });
        }
Example #2
0
        public static void InsertBatchIntoTable(IEnumerable <Person> people)
        {
            TableBatchOperation batchOperation = new TableBatchOperation();
            CloudTable          cloudTable     = AzureUtils.GetCloudTable(Parameters.TableName);

            foreach (var person in people)
            {
                batchOperation.Insert(person);
            }

            cloudTable.ExecuteBatchAsync(batchOperation).Wait();
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("--- Azure Storage Table Performance Test ---");
            Console.WriteLine($"--- Uploading and querying a dataset of {Parameters.NumberOfPeopleToUpload.ToString("##,#")} people ---");
            Console.WriteLine($"--- People are partitioned into {Parameters.ItalianRegionToPopulation.Count} regions --- {Environment.NewLine}");

            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            AzureUtils.CreateTableIfNotExists(Parameters.TableName);

            IList <RegionInputTestData> testInputData = GenerateTestInputData();

            IList <RegionTestData> regionDataset = GenerateDatasetAndUploadItToAzure(testInputData);

            WriteDatasetToQueryOnFileIfRequired(regionDataset);

            PerformQueryOnRandomDataset(regionDataset);

            Console.ReadLine();
        }