Exemple #1
0
        static void InsertData(CloudTableClient cloudTableClient)
        {
            CloudTable cloudTable = cloudTableClient.GetTableReference("table1");

            cloudTable.CreateIfNotExists();
            //CarEntity carEntity = new CarEntity(100, 2018, "Suzuki", "Ciaz", "Black");
            CarEntity      carEntity = new CarEntity(101, 2018, "BMW", "X1", "Blue");
            TableOperation insert    = TableOperation.Insert(carEntity);

            cloudTable.Execute(insert);
        }
Exemple #2
0
        static void InsertDataWithTransaction(CloudTableClient cloudTableClient)
        {
            CloudTable cloudTable = cloudTableClient.GetTableReference("table1");

            cloudTable.CreateIfNotExists();
            TableBatchOperation tbo       = new TableBatchOperation();
            CarEntity           carEntity = new CarEntity(102, 2018, "Tata", "Safari", "Silver");

            tbo.Insert(carEntity);
            carEntity = new CarEntity(103, 2016, "Honda", "Civic", "White");
            tbo.Insert(carEntity);

            cloudTable.ExecuteBatch(tbo);
        }