コード例 #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var constr = new Properties.Settings().StorageConnectionString;
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("people");

            // Create a new customer entity.
            CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
            customer1.Email = "*****@*****.**";
            customer1.PhoneNumber = "425-555-0101";

            // Create the TableOperation object that inserts the customer entity.
            TableOperation insertOperation = TableOperation.Insert(customer1);

            // Execute the insert operation.
            table.Execute(insertOperation);
        }
コード例 #2
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            var constr = new Properties.Settings().StorageConnectionString;
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("people");

            // Create the batch operation.
            TableBatchOperation batchOperation = new TableBatchOperation();

            var l = System.Environment.TickCount;

            for(var c = 0; c < 100; c++)
            {
                // Create a customer entity and add it to the table.
                CustomerEntity customer = new CustomerEntity("kiyotaka", "abe" + c);
                customer.Email = "*****@*****.**" + c;
                customer.PhoneNumber = "425-555-0104" + c;

                batchOperation.Insert(customer);
            }

            // Execute the batch operation.
            table.ExecuteBatch(batchOperation);

            //処理時間=1265ms
            Debug.WriteLine("処理時間=" + (System.Environment.TickCount - l));
        }