azure - Why do not CloudTableQuery.Begin/EndExecuteSegmented auto-hande continuation tokens -


i using .net storage client (june 2012) , have query following

(from e in tablecontext.createquery<entity>(tablename)  select e).astableservicequery(); 

this returns cloudtablequery type , documented as:

“converts query of type dataservicequery cloudtablequery object handles continuation tokens , retries failed calls table service.”

i have tried make cloudtablequery handle pagination “internally” in table service responses me. execute() method this, handles continuation tokens if there more results.

on other hand, when try use asynchronous methods same operation (beginexecutesegmented/endexecutesegmented pair), observed both overloads of beginexecutesegmented not handle pagination internally (as advertised in astableservicequery() docs).

therefore wrote following snippet:

while (true){     var ar = continuationtoken == null ?         entities.beginexecutesegmented(null, null)         : entities.beginexecutesegmented(continuationtoken, null, null);      var task = task.factory.fromasync(ar, r => entities.endexecutesegmented(r));     var resultsegment = await task;     results.addrange(resultsegment.results);     if (resultsegment.hasmoreresults)     {         continuationtoken = resultsegment.continuationtoken;     }     else { break; } } 

this handles pagination trying understand why not begin/endexecutesegmented of cloudtablequery handle pagination internally synchronous equivalent execute() does.

thanks.

executesegmented returns single result segment, contains entities , continuation token. execute, on other hand, handles continuation internally , iterate through result segments.

but right beginexecute , endexecute not there in windows azure storage client library. reason definition of ienumerable. ienumerable not asynchronous , therefore, implementation have block caller when needs fetch next result segment, not asynchronous.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -