spdev
spdev

Reputation: 361

Migrating to the new Azure SDK storage

I have a code base written using the earlier version of TableStorage in Azure. Therefore I have used TableServiceContext class. Now with the upgrade I am expected to use CloudTable. The main differences I see between these two is that that TableServiceContext works with a a bunch of tables and bunch of changes spanning across multiple tables. So when I need to update everything I just need to call SaveChangesWithRetries(). However TableStorage only works with only one table, so how do I achieve the same functionality as TableServiceContext?

Upvotes: 0

Views: 66

Answers (1)

Chris Brooks - MSFT
Chris Brooks - MSFT

Reputation: 35

The TableServiceContext would allow you to save accumulated changes, but its actual calls to the table service would still be individual operations unless you had a group of them on the same partition key.

This "SaveChanges" pattern is no longer supported in the client library.

The CloudTable reflects the actual capabilities of the service more directly, and changes across tables must be made independently.

Individual operations use the Execute operation.

https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.cloudtable.execute.aspx

You can batch a set of changes to records that share a partition key using ExecuteBatch.

https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.cloudtable.executebatch.aspx

Upvotes: 1

Related Questions