當前位置: 首頁>>代碼示例>>C#>>正文


C# Table.TableContinuationToken類代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Table.TableContinuationToken的典型用法代碼示例。如果您正苦於以下問題:C# TableContinuationToken類的具體用法?C# TableContinuationToken怎麽用?C# TableContinuationToken使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TableContinuationToken類屬於Microsoft.WindowsAzure.Storage.Table命名空間,在下文中一共展示了TableContinuationToken類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetEvents

        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;
        }
開發者ID:thomasjetzinger,項目名稱:smarthomecloud,代碼行數:11,代碼來源:EventDataConnector.cs

示例2: SerializeToken

 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);
 }
開發者ID:qjuanp,項目名稱:azure-table-storage-examples,代碼行數:7,代碼來源:ContinuationTokenResolver.cs

示例3: GetAllEvents

        public TableQuerySegment<EventEntity> GetAllEvents(TableContinuationToken token)
        {
            TableQuery<EventEntity> query = new TableQuery<EventEntity>().Take(100);
            TableQuerySegment<EventEntity> resultSegment = table.ExecuteQuerySegmented(query, token);

            return resultSegment;
        }
開發者ID:thomasjetzinger,項目名稱:smarthomecloud,代碼行數:7,代碼來源:EventDataConnector.cs

示例4: QueryImpl

        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;
        }
開發者ID:BurtHarris,項目名稱:azure-storage-net,代碼行數:33,代碼來源:TableQuery.cs

示例5: ExecuteQuerySegmented

        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);
        }
開發者ID:Jasontang501,項目名稱:azure-sdk-for-net,代碼行數:10,代碼來源:TableQueryNonGeneric.cs

示例6: Serialize

 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();
 }
開發者ID:JamesRandall,項目名稱:AccidentalFish.ApplicationSupport,代碼行數:10,代碼來源:TableContinuationTokenSerializer.cs

示例7: Serialize

        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();
            }
        }
開發者ID:vvmoppescapita,項目名稱:AccidentalFish.ApplicationSupport,代碼行數:13,代碼來源:TableContinuationTokenSerializer.cs

示例8: BeginExecuteQuerySegmented

        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);
        }
開發者ID:Jasontang501,項目名稱:azure-sdk-for-net,代碼行數:14,代碼來源:TableQueryNonGeneric.cs

示例9: ExecuteQuerySegmentedAsync

        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));
        }
開發者ID:huoxudong125,項目名稱:azure-sdk-for-net,代碼行數:14,代碼來源:TableQuery.cs

示例10: GetTableDataByDate

 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);
 }
開發者ID:rajmannartech,項目名稱:azure-web-storage-explorer,代碼行數:16,代碼來源:StorageRepository.cs

示例11: CloudTableSegmentedQuery

        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;
        }
開發者ID:savamura,項目名稱:Journalist,代碼行數:17,代碼來源:CloudTableSegmentedQuery.cs

示例12: ClassCleanup

      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 );
      }
開發者ID:TechSmith,項目名稱:hyde,代碼行數:18,代碼來源:SaveAtomicallyTest.cs

示例13: ListTablesSegmentedAsync

        /// <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);
                    });
        }
開發者ID:dtretyakov,項目名稱:WindowsAzure,代碼行數:32,代碼來源:CloudTableClientExtensions.cs

示例14: DeserializeToken

        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;            
        }
開發者ID:ConnorMcMahon,項目名稱:azure-webjobs-sdk,代碼行數:19,代碼來源:Utility.cs

示例15: Get1000Tweets

 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;
 }
開發者ID:skovborg,項目名稱:geek-retreat-workshop,代碼行數:19,代碼來源:TweetFactory.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.TableContinuationToken類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。