コード例 #1
1
        public TableQuerySegment<EventEntity> GetEvents(TableContinuationToken token, EventFilter filter)
        {
            var list = (from events in table.CreateQuery<EventEntity>()
                       where events.alerttype.Equals(filter.type) select events
               );

            TableQuery<EventEntity> query = new TableQuery<EventEntity>().Where(filter.GetFilterString()).Take(100);
            TableQuerySegment<EventEntity> resultSegment = table.ExecuteQuerySegmented(query, token);

            return resultSegment;
        }
コード例 #2
0
 public string SerializeToken(TableContinuationToken tableContinuationToken)
 {
     if (tableContinuationToken == null) return string.Empty;
     var serialized = JsonConvert.SerializeObject(tableContinuationToken);
     var bytes = Encoding.UTF8.GetBytes(serialized);
     return Convert.ToBase64String(bytes);
 }
コード例 #3
0
        public TableQuerySegment<EventEntity> GetAllEvents(TableContinuationToken token)
        {
            TableQuery<EventEntity> query = new TableQuery<EventEntity>().Take(100);
            TableQuerySegment<EventEntity> resultSegment = table.ExecuteQuerySegmented(query, token);

            return resultSegment;
        }
コード例 #4
0
        protected async Task<IList<IDictionary<string, object>>> FetchEntities(string filter)
        {
            Require.NotEmpty(filter, "filter");

            var query = new TableQuery<DynamicTableEntity>()
                .Select(m_properties)
                .Where(filter);

            List<IDictionary<string, object>> result;
            if (m_take.HasValue)
            {
                query = query.Take(m_take.Value);
                result = new List<IDictionary<string, object>>(m_take.Value);
            }
            else
            {
                result = new List<IDictionary<string, object>>();
            }

            var queryResult = await m_fetchEntities(query, m_continuationToken);
            result.AddRange(queryResult.Results.Select(m_tableEntityConverter.CreatePropertiesFromDynamicTableEntity));

            m_continuationToken = queryResult.ContinuationToken;
            m_executionStarted = true;

            return result;
        }
コード例 #5
0
        private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
        {
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUriList = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
            RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, tempUriList);
            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.Handler = client.AuthenticationHandler;
            queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
            queryCmd.Builder = builder;
            queryCmd.BuildRequest = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx);
            queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = async (cmd, resp, ctx) =>
            {
                TableQuerySegment resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);
                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return resSeg;
            };

            return queryCmd;
        }
コード例 #6
0
        internal TableQuerySegment<DynamicTableEntity> ExecuteQuerySegmented(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            CommonUtils.AssertNotNullOrEmpty("tableName", tableName);
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
            operationContext = operationContext ?? new OperationContext();

            RESTCommand<TableQuerySegment<DynamicTableEntity>> cmdToExecute = QueryImpl(this, token, client, tableName, modifiedOptions);

            return Executor.ExecuteSync(cmdToExecute, modifiedOptions.RetryPolicy, operationContext);
        }
 public string Serialize(TableContinuationToken continuationToken)
 {
     if (continuationToken == null) return null;
     StringBuilder sb = new StringBuilder();
     using (XmlWriter xmlWriter = XmlWriter.Create(new StringWriter(sb)))
     {
         continuationToken.WriteXml(xmlWriter);
     }
     return sb.ToString();
 }
        public string Serialize(TableContinuationToken continuationToken)
        {
            if (continuationToken == null) return null;

            using (StringWriter stringWriter = new StringWriter())
            {
                using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter))
                {
                    continuationToken.WriteXml(xmlWriter);
                }
                return stringWriter.ToString();
            }
        }
コード例 #9
0
        internal ICancellableAsyncResult BeginExecuteQuerySegmented(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)
        {
            CommonUtils.AssertNotNullOrEmpty("tableName", tableName);

            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
            operationContext = operationContext ?? new OperationContext();

            return Executor.BeginExecuteAsync(
                                          QueryImpl(this, token, client, tableName, modifiedOptions),
                                          modifiedOptions.RetryPolicy,
                                          operationContext,
                                          callback,
                                          state);
        }
コード例 #10
0
        internal IAsyncOperation<TableQuerySegment> ExecuteQuerySegmentedAsync(TableContinuationToken continuationToken, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            CommonUtility.AssertNotNullOrEmpty("tableName", tableName);
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
            operationContext = operationContext ?? new OperationContext();

            RESTCommand<TableQuerySegment> cmdToExecute = QueryImpl(this, continuationToken, client, tableName, modifiedOptions);

            return AsyncInfo.Run(async (cancellationToken) => await Executor.ExecuteAsync(
                                                                                       cmdToExecute,
                                                                                       modifiedOptions.RetryPolicy,
                                                                                       operationContext,
                                                                                       cancellationToken));
        }
コード例 #11
0
 public async Task<TableQuerySegment<DynamicTableEntity>> GetTableDataByDate(string tableName, string filter, DateTime from, DateTime to, TableContinuationToken continuationToken, bool hasLeadingZero)
 {
     var fromUtc = from.ToUniversalTime();
     var toUtc = to.ToUniversalTime();
     var lead = hasLeadingZero ? "0" : "";
     string fromFilter = TableQuery.GenerateFilterCondition("PartitionKey",
         QueryComparisons.GreaterThanOrEqual, string.Format("{0}{1}", lead, fromUtc.Ticks));
     string toFilter = TableQuery.GenerateFilterCondition("PartitionKey",
         QueryComparisons.LessThan, string.Format("{0}{1}", lead, toUtc.Ticks));
     var filterQuery = TableQuery.CombineFilters(toFilter, TableOperators.And, fromFilter);
     if (!String.IsNullOrEmpty(filter))
     {
         filterQuery = TableQuery.CombineFilters(filter, TableOperators.And, filterQuery);
     }
     return await GetData(tableName, filterQuery, continuationToken);
 }
コード例 #12
0
        protected CloudTableSegmentedQuery(
            int? take,
            string[] properties,
            Func<TableQuery<DynamicTableEntity>, TableContinuationToken, Task<TableQuerySegment<DynamicTableEntity>>> fetchEntities,
            ITableEntityConverter tableEntityConverter)
        {
            Require.True(!take.HasValue || take > 0, "take", "Value should contains positive value");
            Require.NotNull(properties, "properties");
            Require.NotNull(fetchEntities, "fetchEntities");
            Require.NotNull(tableEntityConverter, "tableEntityConverter");

            m_take = take;
            m_properties = properties;
            m_fetchEntities = fetchEntities;
            m_tableEntityConverter = tableEntityConverter;
            m_continuationToken = null;
        }
コード例 #13
0
        /// <summary>
        ///     Returns an enumerable collection of tables in the storage account asynchronously.
        /// </summary>
        /// <param name="tableClient">Cloud table client.</param>
        /// <param name="prefix">The table name prefix.</param>
        /// <param name="maxResults">
        ///     A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
        ///     per-operation limit of 5000. If this value is zero the maximum possible number of results will be returned, up to 5000.
        /// </param>
        /// <param name="continuationToken">Continuation token.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>
        ///     An enumerable collection of tables that are retrieved lazily.
        /// </returns>
        public static Task<TableResultSegment> ListTablesSegmentedAsync(
            this CloudTableClient tableClient,
            string prefix,
            int? maxResults,
            TableContinuationToken continuationToken,
            CancellationToken cancellationToken = default (CancellationToken))
        {
            ICancellableAsyncResult asyncResult = tableClient.BeginListTablesSegmented(prefix, maxResults, continuationToken, null, null, null, null);
            CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null);

            return Task<TableResultSegment>.Factory.FromAsync(
                asyncResult,
                result =>
                    {
                        registration.Dispose();
                        return tableClient.EndListTablesSegmented(result);
                    });
        }
コード例 #14
0
ファイル: SaveAtomicallyTest.cs プロジェクト: TechSmith/hyde
      public static void ClassCleanup()
      {
         var storageAccountProvider = Configuration.GetTestStorageAccount();

         var client = new CloudTableClient( new Uri( storageAccountProvider.TableEndpoint ), storageAccountProvider.Credentials );

         TableContinuationToken token = new TableContinuationToken();
         do
         {
            var orphanedTables = client.ListTablesSegmentedAsync( _baseTableName, token ).Result;
            token = orphanedTables.ContinuationToken;
            foreach ( CloudTable orphanedTableName in orphanedTables.Results )
            {
               client.GetTableReference( orphanedTableName.Name ).DeleteIfExistsAsync().Wait();
            }
         }
         while ( token != null );
      }
コード例 #15
0
 public TableQuerySegment<TweetTableEntity> Get1000Tweets(ref TableContinuationToken token)
 {
     var query = new TableQuery();
     EntityResolver<TweetTableEntity> tweetTableEntityResolver = (pk, rk, ts, props, etag) =>
     {
         var resolvedEntity = new TweetTableEntity
         {
             PartitionKey = pk,
             RowKey = rk,
             Timestamp = ts,
             ETag = etag,
         };
         resolvedEntity.ReadEntity(props, null);
         return resolvedEntity;
     };
     var segment = _tweetsTable.ExecuteQuerySegmented(query, tweetTableEntityResolver, token);
     token = segment.ContinuationToken;
     return segment;
 }
コード例 #16
0
        public static TableContinuationToken DeserializeToken(string token)
        {
            if (!string.IsNullOrWhiteSpace(token))
            {
                var raw = DecodeBase64(token);
                TableContinuationToken contToken = null;

                using (var stringReader = new StringReader(raw))
                {
                    contToken = new TableContinuationToken();
                    using (var xmlReader = XmlReader.Create(stringReader))
                    {
                        contToken.ReadXml(xmlReader);
                    }
                }
                return contToken;
            }
            return null;            
        }
コード例 #17
0
        private async Task<TableQuerySegment<DynamicTableEntity>> GetData(string tableName, string filter, TableContinuationToken continuationToken)
        {
            var table = tableClient.GetTableReference(tableName);
            if (!table.Exists())
            {
                throw new ArgumentException("Table does not exist", tableName);
            }

            var query = new TableQuery<DynamicTableEntity>();
            if (!String.IsNullOrEmpty(filter))
            {
                query = query.Where(filter);
            }

            if (continuationToken != null)
            {
                continuationToken.NextTableName = tableName;
            }
            return await table.ExecuteQuerySegmentedAsync(query, continuationToken);
        }
コード例 #18
0
        public static string SerializeToken(TableContinuationToken token)
        {
            if (token == null)
            {
                return null;
            }

            using (var writer = new StringWriter(CultureInfo.InvariantCulture))
            {
                using (var xmlWriter = XmlWriter.Create(writer))
                {
                    token.WriteXml(xmlWriter);
                }
                string serialized = writer.ToString();
                var val = EncodeBase64(serialized);
                return val;
            }

           
        }
コード例 #19
0
        public HttpResponseMessage Get([FromUri]EventFilter filter, string NextPartitionKey = null, string NextRowKey = null)
        {
            TableContinuationToken token = null;
            if (!String.IsNullOrEmpty(NextPartitionKey) && !String.IsNullOrEmpty(NextRowKey))
            {
                token = new TableContinuationToken();
                token.NextRowKey = NextRowKey;
                token.NextPartitionKey = NextPartitionKey;
                token.TargetLocation = Microsoft.WindowsAzure.Storage.StorageLocation.Primary;
            }
            var values = dataConnector.GetEvents(token,filter);
            var response = Request.CreateResponse(HttpStatusCode.OK, values);

            //add continuation token to header
            if (values.ContinuationToken != null && !String.IsNullOrEmpty(values.ContinuationToken.NextPartitionKey) && !String.IsNullOrEmpty(values.ContinuationToken.NextRowKey))
            {
                response.Headers.Add("x-ms-continuation-NextPartitionKey", values.ContinuationToken.NextPartitionKey);
                response.Headers.Add("x-ms-continuation-NextRowKey", values.ContinuationToken.NextRowKey);

            }
            return response;
        }
コード例 #20
0
        public ActionResult List(string pk, string rk)
        {
            var storageAccount = CloudStorageAccount.Parse(_storageConnection);

            var tableClient = storageAccount.CreateCloudTableClient();

            var table = tableClient.GetTableReference("SlabLogsTable");

            if (!table.Exists())
                return HttpNotFound();

            var query = (from ent in table.CreateQuery<SlabLogsTable>()
                         select ent)
                         .Take(100)
                         .AsTableQuery();

            TableContinuationToken token = null;

            if (!string.IsNullOrEmpty(pk) && !string.IsNullOrEmpty(rk))
                token = new TableContinuationToken() { NextPartitionKey = pk, NextRowKey = rk };

            var queryResult = query.ExecuteSegmented(token);

            var results = queryResult
                            .ToList()
                            .OrderByDescending(i => i.EventDate); // added to handle issue when rowkey not deterministic across apps

            if (queryResult.ContinuationToken != null)
            {
                ViewBag.HasNextPage = true;
                ViewBag.NextPartitionKey = queryResult.ContinuationToken.NextPartitionKey;
                ViewBag.NextRowKey = queryResult.ContinuationToken.NextRowKey;
            }
            else
                ViewBag.HasNextPage = false;

            return View(results);
        }
コード例 #21
0
        public async Task<ContinousResult> ListByDay(DateTime day, string token)
        {
            var table = await GetTable();
            var tableContinuationToken = new TableContinuationToken();
            var tokenResolver = new ContinuationTokenResolver();

            if (!string.IsNullOrEmpty(token))
                tableContinuationToken = tokenResolver.GetToken(token);

            var queryOperation = table.CreateQuery<PageTableEntity>()
                .Where(p => p.PartitionKey == day.Ticks.ToString())
                .Take(10)
                .AsTableQuery();

            var tableSegmentedResults = await table.ExecuteQuerySegmentedAsync(queryOperation, tableContinuationToken);

            if (tableSegmentedResults == null || !tableSegmentedResults.Results.Any()) return null;

            return new ContinousResult
            {
                Token = tokenResolver.SerializeToken(tableSegmentedResults.ContinuationToken),
                Content = tableSegmentedResults.Results.Select(ToPage).ToList()
            };
        }
コード例 #22
0
        private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
        {
            Uri tempUri = NavigationHelper.AppendPathToUri(client.BaseUri, tableName);
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            Uri reqUri = builder.AddToUri(tempUri);

            RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, reqUri);
            queryCmd.ApplyRequestOptions(requestOptions);

            queryCmd.RetrieveResponseStream = true;
            queryCmd.Handler = client.AuthenticationHandler;
            queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
            queryCmd.BuildRequest = (cmd, cnt, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(cmd.Uri, cmd.ServerTimeoutInSeconds, ctx);
            queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = (cmd, resp, ctx) => TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);

            return queryCmd;
        }
コード例 #23
0
 public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, TableContinuationToken currentToken)
 {
     return(this.ListTablesSegmentedAsync(prefix, null /* maxResults */, currentToken, null /* TableRequestOptions */, null /* OperationContext */));
 }
コード例 #24
0
 /// <summary>
 /// Returns a result segment containing a collection of tables beginning with the specified prefix.
 /// </summary>
 /// <param name="prefix">The table name prefix.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
 /// per-operation limit of 5000. If this value is <c>null</c> the maximum possible number of results will be returned, up to 5000.</param>
 /// <param name="currentToken">A <see cref="TableContinuationToken"/> token returned by a previous listing operation.</param>
 /// <param name="requestOptions">A <see cref="TableRequestOptions"/> object that specifies additional options for the request.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that provides information on how the operation executed.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
 /// <returns>The result segment containing the collection of tables.</returns>
 public Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
コード例 #25
0
 public virtual TableResultSegment ListTablesSegmented(string prefix, TableContinuationToken currentToken)
 {
     return(this.ListTablesSegmented(prefix, null, currentToken));
 }
コード例 #26
0
 public virtual ICancellableAsyncResult BeginListTablesSegmented(TableContinuationToken currentToken, AsyncCallback callback, object state)
 {
     return(this.BeginListTablesSegmented(null, currentToken, callback, state));
 }
コード例 #27
0
        internal IAsyncOperation <TableQuerySegment <TElement> > ExecuteQuerySegmentedAsync(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
#endif
        {
            CommonUtility.AssertNotNullOrEmpty("tableName", tableName);
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);

            operationContext = operationContext ?? new OperationContext();

            RESTCommand <TableQuerySegment <TElement> > cmdToExecute = QueryImpl(this, token, client, tableName, EntityUtilities.ResolveEntityByType <TElement>, modifiedOptions);

#if ASPNET_K
            return(Task.Run(async() => await Executor.ExecuteAsync(
                                cmdToExecute,
                                modifiedOptions.RetryPolicy,
                                operationContext,
                                cancellationToken), cancellationToken));
#else
            return(AsyncInfo.Run(async(cancellationToken) => await Executor.ExecuteAsync(
                                     cmdToExecute,
                                     modifiedOptions.RetryPolicy,
                                     operationContext,
                                     cancellationToken)));
#endif
        }
コード例 #28
0
        private static RESTCommand <TableQuerySegment <RESULT_TYPE> > QueryImpl <RESULT_TYPE>(TableQuery query, TableContinuationToken token, CloudTableClient client, CloudTable table, EntityResolver <RESULT_TYPE> resolver, TableRequestOptions requestOptions)
        {
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUri = NavigationHelper.AppendPathToUri(client.StorageUri, table.Name);
            RESTCommand <TableQuerySegment <RESULT_TYPE> > queryCmd = new RESTCommand <TableQuerySegment <RESULT_TYPE> >(client.Credentials, tempUri);

            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode    = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.SignRequest            = client.AuthenticationHandler.SignRequest;
            queryCmd.Builder              = builder;
            queryCmd.ParseError           = StorageExtendedErrorInformation.ReadFromStreamUsingODataLib;
            queryCmd.BuildRequestDelegate = (uri, queryBuilder, timeout, ctx) => TableOperationHttpWebRequestFactory.BuildRequestForTableQuery(uri, queryBuilder, timeout, ctx, requestOptions.PayloadFormat.Value);
            queryCmd.PreProcessResponse   = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp != null ? resp.StatusCode : HttpStatusCode.Unused, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse  = (cmd, resp, ctx) =>
            {
                ResultSegment <RESULT_TYPE> resSeg = TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <RESULT_TYPE, DynamicTableEntity>(cmd.ResponseStream, resolver.Invoke, resp, requestOptions, ctx, client.AccountName);
                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return(new TableQuerySegment <RESULT_TYPE>(resSeg));
            };

            return(queryCmd);
        }
コード例 #29
0
        private RESTCommand <TableQuerySegment <RESULT_TYPE> > QueryImpl <RESULT_TYPE>(TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <RESULT_TYPE> resolver, TableRequestOptions requestOptions)
        {
            UriQueryBuilder builder = this.GenerateQueryBuilder(requestOptions.ProjectSystemProperties);

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUri = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
            RESTCommand <TableQuerySegment <RESULT_TYPE> > queryCmd = new RESTCommand <TableQuerySegment <RESULT_TYPE> >(client.Credentials, tempUri);

            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode    = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.ParseError             = StorageExtendedErrorInformation.ReadFromStreamUsingODataLib;
            queryCmd.Builder             = builder;
            queryCmd.BuildRequest        = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx, requestOptions.PayloadFormat.Value, client.GetCanonicalizer(), client.Credentials);
            queryCmd.PreProcessResponse  = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = async(cmd, resp, ctx) =>
            {
                ResultSegment <RESULT_TYPE> resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <RESULT_TYPE>(cmd.ResponseStream, resolver.Invoke, resp, requestOptions, ctx, client.AccountName);

                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return(new TableQuerySegment <RESULT_TYPE>(resSeg));
            };

            return(queryCmd);
        }
コード例 #30
0
 internal Task <TableQuerySegment> ExecuteQuerySegmentedAsync(TableContinuationToken continuationToken, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
 {
     return(ExecuteQuerySegmentedAsync(continuationToken, client, tableName, requestOptions, operationContext, CancellationToken.None));
 }
コード例 #31
0
        private static RESTCommand <TableQuerySegment <RESULT_TYPE> > QueryImpl <RESULT_TYPE>(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <RESULT_TYPE> resolver, TableRequestOptions requestOptions)
        {
            Uri             tempUri = NavigationHelper.AppendPathToUri(client.BaseUri, tableName);
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            Uri reqUri = builder.AddToUri(tempUri);

            RESTCommand <TableQuerySegment <RESULT_TYPE> > queryCmd = new RESTCommand <TableQuerySegment <RESULT_TYPE> >(client.Credentials, reqUri);

            queryCmd.ApplyRequestOptions(requestOptions);

            queryCmd.RetrieveResponseStream = true;
            queryCmd.Handler             = client.AuthenticationHandler;
            queryCmd.BuildClient         = HttpClientFactory.BuildHttpClient;
            queryCmd.BuildRequest        = (cmd, cnt, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(cmd.Uri, cmd.ServerTimeoutInSeconds, ctx);
            queryCmd.PreProcessResponse  = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = async(cmd, resp, ctx) =>
            {
                ResultSegment <RESULT_TYPE> resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <RESULT_TYPE>(cmd.ResponseStream, resolver.Invoke, resp, ctx);

                return(new TableQuerySegment <RESULT_TYPE>(resSeg));
            };

            return(queryCmd);
        }
コード例 #32
0
        internal Task <TableQuerySegment <TResult> > ExecuteQuerySegmentedAsync <TResult>(TableContinuationToken continuationToken, CloudTableClient client, string tableName, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
        {
            CommonUtility.AssertNotNullOrEmpty("tableName", tableName);
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);

            operationContext = operationContext ?? new OperationContext();

            RESTCommand <TableQuerySegment <TResult> > cmdToExecute = this.QueryImpl <TResult>(continuationToken, client, tableName, resolver, modifiedOptions);

            return(Task.Run(async() => await Executor.ExecuteAsync(
                                cmdToExecute,
                                modifiedOptions.RetryPolicy,
                                operationContext,
                                cancellationToken), cancellationToken));
        }
コード例 #33
0
 public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, TableContinuationToken currentToken, CancellationToken cancellationToken)
 {
     return(AsyncExtensions.TaskFromApm(this.BeginListTablesSegmented, this.EndListTablesSegmented, prefix, currentToken, cancellationToken));
 }
コード例 #34
0
        public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
        {
            requestOptions   = TableRequestOptions.ApplyDefaults(requestOptions, this);
            operationContext = operationContext ?? new OperationContext();

            TableQuery query = this.GenerateListTablesQuery(prefix, maxResults);

            return(Task.Run(async() =>
            {
                TableQuerySegment seg = await this.ExecuteQuerySegmentedAsync(TableConstants.TableServiceTablesName, query, currentToken, requestOptions, operationContext, cancellationToken);
                TableResultSegment retSegment = new TableResultSegment(seg.Results.Select(tbl => new CloudTable(tbl.Properties[TableConstants.TableName].StringValue, this)).ToList());
                retSegment.ContinuationToken = seg.ContinuationToken;
                return retSegment;
            }, cancellationToken));
        }
コード例 #35
0
 public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext)
 {
     return(this.ListTablesSegmentedAsync(prefix, maxResults, currentToken, requestOptions, operationContext, CancellationToken.None));
 }
コード例 #36
0
        private static RESTCommand <TableQuerySegment <RESULT_TYPE> > QueryImpl <T, RESULT_TYPE>(TableQuery <T> query, TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <RESULT_TYPE> resolver, TableRequestOptions requestOptions) where T : ITableEntity, new()
        {
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUri = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
            RESTCommand <TableQuerySegment <RESULT_TYPE> > queryCmd = new RESTCommand <TableQuerySegment <RESULT_TYPE> >(client.Credentials, tempUri);

            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode    = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.Handler             = client.AuthenticationHandler;
            queryCmd.BuildClient         = HttpClientFactory.BuildHttpClient;
            queryCmd.Builder             = builder;
            queryCmd.BuildRequest        = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx);
            queryCmd.PreProcessResponse  = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = async(cmd, resp, ctx) =>
            {
                ResultSegment <RESULT_TYPE> resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <RESULT_TYPE>(cmd.ResponseStream, resolver.Invoke, resp, ctx);

                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return(new TableQuerySegment <RESULT_TYPE>(resSeg));
            };

            return(queryCmd);
        }
コード例 #37
0
 public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, TableContinuationToken currentToken)
 {
     return(this.ListTablesSegmentedAsync(prefix, currentToken, CancellationToken.None));
 }
コード例 #38
0
 internal Task <TableQuerySegment <TElement> > ExecuteQuerySegmentedAsync(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
コード例 #39
0
        internal IAsyncOperation <TableQuerySegment <TResult> > ExecuteQuerySegmentedAsync <TResult>(TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            CommonUtility.AssertNotNullOrEmpty("tableName", tableName);
            CommonUtility.AssertNotNull("resolver", resolver);

            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);

            operationContext = operationContext ?? new OperationContext();

            RESTCommand <TableQuerySegment <TResult> > cmdToExecute = QueryImpl(this, token, client, tableName, resolver, modifiedOptions);

            return(AsyncInfo.Run((cancellationToken) => Executor.ExecuteAsync(
                                     cmdToExecute,
                                     modifiedOptions.RetryPolicy,
                                     operationContext,
                                     cancellationToken)));
        }
コード例 #40
0
 internal TableQuerySegment(ResultSegment <TElement> resSeg)
     : this(resSeg.Results)
 {
     this.continuationToken = (TableContinuationToken)resSeg.ContinuationToken;
 }
コード例 #41
0
 /// <summary>
 /// Executes a query asynchronously in segmented mode, using the specified <see cref="TableQuery{T}"/> query and <see cref="TableContinuationToken"/> continuation token, and applies the <see cref="EntityResolver{T}"/> to the result.
 /// </summary>
 /// <typeparam name="T">The entity type of the query.</typeparam>
 /// <typeparam name="TResult">The type into which the <see cref="EntityResolver{T}"/> will project the query results.</typeparam>
 /// <param name="table">The input <see cref="CloudTable"/>, which acts as the <c>this</c> instance for the extension method.</param>
 /// <param name="query">A <see cref="TableQuery{T}"/> representing the query to execute.</param>
 /// <param name="resolver">An <see cref="EntityResolver{R}"/> instance which creates a projection of the table query result entities into the specified type <c>TResult</c>.</param>
 /// <param name="token">A <see cref="TableContinuationToken"/> object representing a continuation token from the server when the operation returns a partial result.</param>
 /// <returns>A <see cref="TableQuerySegment{R}"/> containing the projection into type <c>TResult</c> of the results of executing the query.</returns>
 public static IAsyncOperation <TableQuerySegment <TResult> > ExecuteQuerySegmentedAsync <T, TResult>(this CloudTable table, TableQuery <T> query, EntityResolver <TResult> resolver, TableContinuationToken token) where T : ITableEntity, new()
 {
     return(table.ExecuteQuerySegmentedAsync <T, TResult>(query, resolver, token, null /* requestOptions */, null /* operationContext */));
 }
コード例 #42
0
        public virtual ICancellableAsyncResult BeginListTablesSegmented(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)
        {
            requestOptions   = TableRequestOptions.ApplyDefaultsAndClearEncryption(requestOptions, this);
            operationContext = operationContext ?? new OperationContext();
            CloudTable serviceTable = this.GetTableReference(TableConstants.TableServiceTablesName);

            return(CloudTableClient.GenerateListTablesQuery(prefix, maxResults).BeginExecuteQuerySegmentedInternal(
                       currentToken,
                       this,
                       serviceTable,
                       requestOptions,
                       operationContext,
                       callback,
                       state));
        }
コード例 #43
0
 /// <summary>
 /// Executes a query asynchronously in segmented mode, using the specified <see cref="TableQuery{T}"/> query, <see cref="TableContinuationToken"/> continuation token, <see cref="TableRequestOptions"/> options, and <see cref="OperationContext"/> context, and applies the <see cref="EntityResolver{T}"/> to the result.
 /// </summary>
 /// <typeparam name="T">The entity type of the query.</typeparam>
 /// <typeparam name="TResult">The type into which the <see cref="EntityResolver{T}"/> will project the query results.</typeparam>
 /// <param name="table">The input <see cref="CloudTable"/>, which acts as the <c>this</c> instance for the extension method.</param>
 /// <param name="query">A <see cref="TableQuery{T}"/> representing the query to execute.</param>
 /// <param name="resolver">An <see cref="EntityResolver{R}"/> instance which creates a projection of the table query result entities into the specified type <c>TResult</c>.</param>
 /// <param name="token">A <see cref="TableContinuationToken"/> object representing a continuation token from the server when the operation returns a partial result.</param>
 /// <param name="requestOptions">A <see cref="TableRequestOptions"/> object that specifies execution options, such as retry policy and timeout settings, for the operation.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
 /// <returns>A <see cref="TableQuerySegment{R}"/> containing the projection into type <c>TResult</c> of the results of executing the query.</returns>
 public static IAsyncOperation <TableQuerySegment <TResult> > ExecuteQuerySegmentedAsync <T, TResult>(this CloudTable table, TableQuery <T> query, EntityResolver <TResult> resolver, TableContinuationToken token, TableRequestOptions requestOptions, OperationContext operationContext) where T : ITableEntity, new()
 {
     CommonUtility.AssertNotNull("query", query);
     CommonUtility.AssertNotNull("resolver", resolver);
     return(query.ExecuteQuerySegmentedAsync(token, table.ServiceClient, table.Name, resolver, requestOptions, operationContext));
 }
コード例 #44
0
 public virtual ICancellableAsyncResult BeginListTablesSegmented(string prefix, TableContinuationToken currentToken, AsyncCallback callback, object state)
 {
     return(this.BeginListTablesSegmented(prefix, null, currentToken, null /* RequestOptions */, null /* OperationContext */, callback, state));
 }
コード例 #45
0
        public void TableContinuationTokenVerifySerializer()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(TableContinuationToken));

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;

            StringReader reader;
            string       tokenxml;

            TableContinuationToken writeToken = new TableContinuationToken
            {
                NextPartitionKey = Guid.NewGuid().ToString(),
                NextRowKey       = Guid.NewGuid().ToString(),
                NextTableName    = Guid.NewGuid().ToString(),
                TargetLocation   = StorageLocation.Primary
            };

            TableContinuationToken readToken = null;

            // Write with XmlSerializer
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, writeToken);
                tokenxml = writer.ToString();
            }

            // Read with XmlSerializer
            reader    = new StringReader(tokenxml);
            readToken = (TableContinuationToken)serializer.Deserialize(reader);
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }

            // Write with token.WriteXml
            StringBuilder sb = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
                writeToken.WriteXml(writer);
            }

            // Read with XmlSerializer
            reader    = new StringReader(sb.ToString());
            readToken = (TableContinuationToken)serializer.Deserialize(reader);
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(sb.ToString())))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);
        }
コード例 #46
0
        public virtual TableResultSegment ListTablesSegmented(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions = null, OperationContext operationContext = null)
        {
            requestOptions   = TableRequestOptions.ApplyDefaultsAndClearEncryption(requestOptions, this);
            operationContext = operationContext ?? new OperationContext();
            CloudTable serviceTable = this.GetTableReference(TableConstants.TableServiceTablesName);
            TableQuerySegment <DynamicTableEntity> res =
                CloudTableClient.GenerateListTablesQuery(prefix, maxResults).ExecuteQuerySegmentedInternal(currentToken, this, serviceTable, requestOptions, operationContext);

            List <CloudTable> tables = res.Results.Select(tbl => new CloudTable(
                                                              tbl.Properties[TableConstants.TableName].StringValue,
                                                              this)).ToList();

            TableResultSegment retSeg = new TableResultSegment(tables)
            {
                ContinuationToken = res.ContinuationToken as TableContinuationToken
            };

            return(retSeg);
        }
コード例 #47
0
        private static RESTCommand <TableQuerySegment <RESULT_TYPE> > QueryImpl <T, RESULT_TYPE>(TableQuery <T> query, TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <RESULT_TYPE> resolver, TableRequestOptions requestOptions) where T : ITableEntity, new()
        {
            Uri             tempUri = NavigationHelper.AppendPathToUri(client.BaseUri, tableName);
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            Uri reqUri = builder.AddToUri(tempUri);

            RESTCommand <TableQuerySegment <RESULT_TYPE> > queryCmd = new RESTCommand <TableQuerySegment <RESULT_TYPE> >(client.Credentials, reqUri);

            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.RetrieveResponseStream = true;
            queryCmd.SignRequest            = client.AuthenticationHandler.SignRequest;
            queryCmd.BuildRequestDelegate   = TableOperationHttpWebRequestFactory.BuildRequestForTableQuery;

            queryCmd.PreProcessResponse  = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp != null ? resp.StatusCode : HttpStatusCode.Unused, null /* retVal */, cmd, ex, ctx);
            queryCmd.PostProcessResponse = (cmd, resp, ex, ctx) =>
            {
                ResultSegment <RESULT_TYPE> resSeg = TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <RESULT_TYPE>(cmd.ResponseStream, resolver.Invoke, resp, ex, ctx);
                return(new TableQuerySegment <RESULT_TYPE>(resSeg));
            };

            return(queryCmd);
        }
コード例 #48
0
 public virtual TableResultSegment ListTablesSegmented(TableContinuationToken currentToken)
 {
     return(this.ListTablesSegmented(null, currentToken));
 }
コード例 #49
0
 internal Task <TableQuerySegment <TResult> > ExecuteQuerySegmentedAsync <TResult>(TableContinuationToken token, CloudTableClient client, string tableName, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
コード例 #50
0
 internal Task <TableQuerySegment> ExecuteQuerySegmentedAsync(string tableName, TableQuery query, TableContinuationToken token, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
 {
     CommonUtility.AssertNotNull("query", query);
     return(query.ExecuteQuerySegmentedAsync(token, this, tableName, requestOptions, operationContext, cancellationToken));
 }
コード例 #51
0
 public virtual Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
 {
     return(AsyncExtensions.TaskFromApm(this.BeginListTablesSegmented, this.EndListTablesSegmented, prefix, maxResults, currentToken, requestOptions, operationContext, cancellationToken));
 }
コード例 #52
0
        public IAsyncOperation<TableResultSegment> ListTablesSegmentedAsync(string prefix, int? maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext)
#endif
        {
            requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this);
            operationContext = operationContext ?? new OperationContext();

            TableQuery query = this.GenerateListTablesQuery(prefix, maxResults);

#if ASPNET_K
            return Task.Run(async () =>
            {
                TableQuerySegment seg = await this.ExecuteQuerySegmentedAsync(TableConstants.TableServiceTablesName, query, currentToken, requestOptions, operationContext, cancellationToken);
#else
            return AsyncInfo.Run(async (cancellationToken) =>
            {
                TableQuerySegment seg = await this.ExecuteQuerySegmentedAsync(TableConstants.TableServiceTablesName, query, currentToken, requestOptions, operationContext).AsTask(cancellationToken);
#endif

                TableResultSegment retSegment = new TableResultSegment(seg.Results.Select(tbl => new CloudTable(tbl.Properties[TableConstants.TableName].StringValue, this)).ToList());
                retSegment.ContinuationToken = seg.ContinuationToken;
                return retSegment;
#if ASPNET_K
            }, cancellationToken);
#else
            });
#endif
        }
コード例 #53
0
ファイル: TableQueryNonGeneric.cs プロジェクト: Ankitvaibs/SM
        private static RESTCommand <TableQuerySegment <DynamicTableEntity> > QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions)
        {
            requestOptions.AssertPolicyIfRequired();

            // If encryption policy is set, then add the encryption metadata column to Select columns in order to be able to decrypt properties.
            if (requestOptions.EncryptionPolicy != null && query.SelectColumns != null)
            {
                query.SelectColumns.Add(Constants.EncryptionConstants.TableEncryptionKeyDetails);
                query.SelectColumns.Add(Constants.EncryptionConstants.TableEncryptionPropertyDetails);
            }

            UriQueryBuilder builder = query.GenerateQueryBuilder(requestOptions.ProjectSystemProperties);

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUri = NavigationHelper.AppendPathToUri(client.StorageUri, table.Name);
            RESTCommand <TableQuerySegment <DynamicTableEntity> > queryCmd = new RESTCommand <TableQuerySegment <DynamicTableEntity> >(client.Credentials, tempUri);

            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode    = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.SignRequest            = client.AuthenticationHandler.SignRequest;
            queryCmd.Builder              = builder;
            queryCmd.ParseError           = StorageExtendedErrorInformation.ReadFromStreamUsingODataLib;
            queryCmd.BuildRequestDelegate = (uri, queryBuilder, timeout, useVersionHeader, ctx) => TableOperationHttpWebRequestFactory.BuildRequestForTableQuery(uri, queryBuilder, timeout, useVersionHeader, ctx, requestOptions.PayloadFormat.Value);
            queryCmd.PreProcessResponse   = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp != null ? resp.StatusCode : HttpStatusCode.Unused, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse  = (cmd, resp, ctx) =>
            {
                ResultSegment <DynamicTableEntity> resSeg = TableOperationHttpResponseParsers.TableQueryPostProcessGeneric <DynamicTableEntity, DynamicTableEntity>(cmd.ResponseStream, EntityUtilities.ResolveDynamicEntity, resp, requestOptions, ctx, client.AccountName);
                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return(new TableQuerySegment <DynamicTableEntity>(resSeg));
            };

            return(queryCmd);
        }
コード例 #54
0
        /// <summary>
        /// Returns a result segment containing a collection of tables beginning with the specified prefix.
        /// </summary>
        /// <param name="prefix">The table name prefix.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c> the maximum possible number of results will be returned, up to 5000.</param>         
        /// <param name="currentToken">A <see cref="TableContinuationToken"/> token returned by a previous listing operation.</param> 
        /// <param name="requestOptions">A <see cref="TableRequestOptions"/> object that specifies additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that provides information on how the operation executed.</param>
        /// <returns>The result segment containing the collection of tables.</returns>
#if ASPNET_K
        public Task<TableResultSegment> ListTablesSegmentedAsync(string prefix, int? maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            return this.ListTablesSegmentedAsync(prefix, maxResults, currentToken, requestOptions, operationContext, CancellationToken.None);
        }
コード例 #55
0
 /// <summary>
 /// Returns a result segment containing a collection of tables beginning with the specified prefix.
 /// </summary>
 /// <param name="prefix">The table name prefix.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
 /// per-operation limit of 5000. If this value is <c>null</c> the maximum possible number of results will be returned, up to 5000.</param>         
 /// <param name="currentToken">A <see cref="TableContinuationToken"/> token returned by a previous listing operation.</param> 
 /// <param name="requestOptions">A <see cref="TableRequestOptions"/> object that specifies additional options for the request.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that provides information on how the operation executed.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
 /// <returns>The result segment containing the collection of tables.</returns>
 public Task<TableResultSegment> ListTablesSegmentedAsync(string prefix, int? maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
コード例 #56
0
        public IAsyncOperation<TableResultSegment> ListTablesSegmentedAsync(string prefix, TableContinuationToken currentToken)
#endif
        {
            return this.ListTablesSegmentedAsync(prefix, null /* maxResults */, currentToken, null /* TableRequestOptions */, null /* OperationContext */);
        }
コード例 #57
0
        /// <summary>
        /// Returns a result segment containing a collection of table items beginning with the specified prefix.
        /// </summary>
        /// <param name="prefix">The table name prefix.</param>
        /// <param name="currentToken">A <see cref="TableContinuationToken"/> token returned by a previous listing operation.</param>
        /// <returns>The result segment containing the collection of tables.</returns>
#if ASPNET_K
        public Task<TableResultSegment> ListTablesSegmentedAsync(string prefix, TableContinuationToken currentToken)
コード例 #58
0
 internal Task<TableQuerySegment> ExecuteQuerySegmentedAsync(string tableName, TableQuery query, TableContinuationToken token, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
 {
     CommonUtility.AssertNotNull("query", query);
     return query.ExecuteQuerySegmentedAsync(token, this, tableName, requestOptions, operationContext, cancellationToken);
 }
コード例 #59
-1
 public string Serialize(TableContinuationToken continuationToken)
 {
     if (continuationToken == null)
     {
         return string.Empty;
     }
     return string.Format("{0}|{1}", continuationToken.NextPartitionKey, continuationToken.NextRowKey);
 }
        public TableContinuationToken Deserialize(string serializedContinuationToken)
        {
            if (serializedContinuationToken == null) return null;

            TableContinuationToken continuationToken = new TableContinuationToken();
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(serializedContinuationToken)))
            {
                continuationToken.ReadXml(xmlReader);
            }
            return continuationToken;
        }