Ejemplo n.º 1
0
        private async Task TableStorageOperations()
        {
            TableStorage tableStorage = new TableStorage(config);
            await tableStorage.CreateCustomer(new Customer("pradeep", "panigrahy") { Name = "pradeep", Address = "pune", id = 1 });

            var result = await tableStorage.GetCustomer("pradeep", "panigrahy");

            List <Customer> customers = new List <Customer>();

            Enumerable.Range(1, 10).ToList().ForEach(t => customers.Add(new Customer("firstpartition", $"row{t}")
            {
                Name    = $"firstname{t}",
                Address = $"address{t}"
            }));
            var batchResult = await tableStorage.CreateCustomerBatch(customers);


            TableContinuationToken token = null;

            do
            {
                var getBatchResult = await tableStorage.GetAllCustomer("firstpartition", token);

                token = getBatchResult.ContinuationToken;
                foreach (Customer cust in getBatchResult.Results)
                {
                    customers.Clear();
                    customers.Add(cust);
                }
            } while (token != null);
            token = null;
            var getBatchResult1 = await tableStorage.GetAllCustomer("pradeep", token);
        }