سؤال

I tried using CloudTable::ExecuteBatch(new TableBatchOperation{operation1, operation2}); Each operation was a Retrieve operation. The snippet in question looked like this:

var partitionKey = "1";

var operation1 = TableOperation.Retrieve(partitionKey, "1");
var operation2 = TableOperation.Retrieve(partitionKey, "2");

var executedResult = ExecuteBatch(new TableBatchOperation{operation1, operation2});

I got an exception saying there could not be any retrieve operations in a batch execution. Is there a way to pull this off or is an asynchronous execution the best way to handle multiple partition key, row key look ups? For my use case I will have to look up at most 3 different rows by partition key and row key at the same time.

هل كانت مفيدة؟

المحلول

Yes, batch operations have certain restrictions and do not include GETS. You can try range queries as outlined here, if the partition key remains the same.

Windows Azure table access latency Partition keys and row keys selection

Otherwise, you can query in parallel.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top