Suppose I have:
using (TransactionScope scope = new TransactionScope())
{
if (IndexExists(index.RowKey))
DeleteIndex(index.RowKey); //deletes using TableOperation.Delete
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConnectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference(Const.IndexTable);
TableOperation insertOperation = TableOperation.Insert(index);
table.Execute(insertOperation);
}
What I want is this: if insert fails, delete should be undone. Is this correct way of making transaction? Everything happens in same partition/table. Also what are other limitations of transactions, I've read somewhere that no more than 4 Mb could be stored within transaction, is this still correct?