コード例 #1
0
 /// <summary>
 /// Gets a list of tables from the storage account.
 /// </summary>
 /// <param name="select">Returns the desired properties of an entity from the set. </param>
 /// <param name="filter">Returns only tables or entities that satisfy the specified filter.</param>
 /// <param name="top">Returns only the top n tables or entities from the set.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 /// <returns></returns>
 public virtual Pageable <TableItem> GetTables(string select = null, string filter = null, int?top = null, CancellationToken cancellationToken = default)
 {
     return(PageableHelpers.CreateEnumerable(_ =>
     {
         var response = _tableOperations.Query(
             null,
             null,
             new QueryOptions()
         {
             Filter = filter, Select = select, Top = top, Format = _format
         },
             cancellationToken);
         return Page.FromValues(response.Value.Value, response.Headers.XMsContinuationNextTableName, response.GetRawResponse());
     }, (nextLink, _) =>
     {
         var response = _tableOperations.Query(
             null,
             nextTableName: nextLink,
             new QueryOptions()
         {
             Filter = filter, Select = select, Top = top, Format = _format
         },
             cancellationToken);
         return Page.FromValues(response.Value.Value, response.Headers.XMsContinuationNextTableName, response.GetRawResponse());
     }));
 }
コード例 #2
0
 /// <summary>
 /// Gets a list of tables from the storage account.
 /// </summary>
 /// <param name="filter">Returns only tables that satisfy the specified filter.</param>
 /// <param name="maxPerPage">
 /// The maximum number tables that will be returned per page.
 /// Note: This value does not limit the total number of results if the result is fully enumerated.
 /// </param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
 /// <returns>An <see cref="Pageable{T}"/> containing a collection of <see cref="TableItem"/>.</returns>
 public virtual Pageable <TableItem> GetTables(string filter = null, int?maxPerPage = null, CancellationToken cancellationToken = default)
 {
     return(PageableHelpers.CreateEnumerable(
                pageSizeHint =>
     {
         using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(TableServiceClient)}.{nameof(GetTables)}");
         scope.Start();
         try
         {
             var response = _tableOperations.Query(
                 null,
                 new QueryOptions()
             {
                 Filter = filter, Select = null, Top = pageSizeHint, Format = _format
             },
                 cancellationToken);
             return Page.FromValues(response.Value.Value, response.Headers.XMsContinuationNextTableName, response.GetRawResponse());
         }
         catch (Exception ex)
         {
             scope.Failed(ex);
             throw;
         }
     },
                (nextLink, pageSizeHint) =>
     {
         using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(TableServiceClient)}.{nameof(GetTables)}");
         scope.Start();
         try
         {
             var response = _tableOperations.Query(
                 nextTableName: nextLink,
                 new QueryOptions()
             {
                 Filter = filter, Select = null, Top = pageSizeHint, Format = _format
             },
                 cancellationToken);
             return Page.FromValues(response.Value.Value, response.Headers.XMsContinuationNextTableName, response.GetRawResponse());
         }
         catch (Exception ex)
         {
             scope.Failed(ex);
             throw;
         }
     },
                maxPerPage));
 }