private async Task QueryCollectionAsync(HttpContext httpContext, StatefulServiceContext serviceContext, IReliableStateManager stateManager, string collection) { // Query the reliable collection for all partitions. var query = httpContext.Request.Query.Select(p => new KeyValuePair <string, string>(p.Key, p.Value)); var results = await stateManager.QueryAsync(serviceContext, collection, query, CancellationToken.None).ConfigureAwait(false); httpContext.Response.ContentType = "application/json"; httpContext.Response.StatusCode = (int)HttpStatusCode.OK; // Write the response. var result = new ODataResult { ODataMetadata = "", Value = results, }; string response = JsonConvert.SerializeObject(result); await httpContext.Response.WriteAsync(response).ConfigureAwait(false); }
Task <IEnumerable <string> > IQueryableService.QueryAsync(string collection, IEnumerable <KeyValuePair <string, string> > query) { return(StateManager.QueryAsync(Context, collection, query, CancellationToken.None)); }