Esempio n. 1
0
        private static void InsertCustomer(int p_ID, string p_Name)
        {
            CloudStorageAccount whizlabsStorage     = CloudStorageAccount.Parse(conn_string);
            CloudTableClient    whizlabsTableClient = whizlabsStorage.CreateCloudTableClient();
            CloudTable          whizlabsTable       = whizlabsTableClient.GetTableReference("Customer1");

            Customer1 customer = new Customer1(p_ID, p_Name);

            customer.Email = "*****@*****.**";

            TableOperation insertOperation = TableOperation.Insert(customer);

            whizlabsTable.Execute(insertOperation);

            Console.WriteLine("Entity Inserted");
        }
Esempio n. 2
0
        private static void InsertBatch()
        {
            CloudStorageAccount whizlabsStorage     = CloudStorageAccount.Parse(conn_string);
            CloudTableClient    whizlabsTableClient = whizlabsStorage.CreateCloudTableClient();
            CloudTable          whizlabsTable       = whizlabsTableClient.GetTableReference("Customer1");

            TableBatchOperation batch = new TableBatchOperation();

            Customer1 customer1 = new Customer1(4, "May");

            customer1.Email = "*****@*****.**";
            Customer1 customer2 = new Customer1(4, "Carrie");

            customer2.Email = "*****@*****.**";

            batch.Insert(customer1);
            batch.Insert(customer2);

            whizlabsTable.ExecuteBatch(batch);

            Console.WriteLine("Records Inserted");
        }