Esempio n. 1
0
        public StorageAccountTable()
        {
            // Sample run
            CreateAccount();
            CloudTable table = GetTable($"customers{DateTime.Now.ToLongTimeString().Replace(":", string.Empty)}");

            CreateCustomer(table, new CustomerUK("David", "*****@*****.**"));
            CreateCustomer(table, new CustomerUK("Davidco", "*****@*****.**"));

            PrintAllCustomers(table);

            CustomerUK customerToUpdate = GetCustomer(table, "UK", "*****@*****.**");

            customerToUpdate.Name = "Dave";
            UpdateCustomer(table, customerToUpdate);

            PrintAllCustomers(table);

            DeleteCustomer(table, customerToUpdate);

            PrintAllCustomers(table);

            BatchInsert(table);

            PrintAllCustomers(table);

            table.Delete();
        }
Esempio n. 2
0
        public void CreateCustomer(CloudTable cloudTable, CustomerUK customer)
        {
            TableOperation insert = TableOperation.Insert(customer);

            cloudTable.Execute(insert);
        }
Esempio n. 3
0
        private void UpdateCustomer(CloudTable cloudTable, CustomerUK customerToUpdate)
        {
            TableOperation update = TableOperation.Replace(customerToUpdate);

            cloudTable.Execute(update);
        }