Table of Contents

Class TableQuery<TElement>

Namespace
Microsoft.WindowsAzure.Storage.Table
Assembly
Microsoft.WindowsAzure.Storage.dll

Represents a query against a Microsoft Azure table.

public class TableQuery<TElement> : IQueryable<TElement>, IEnumerable<TElement>, IQueryable, IEnumerable

Type Parameters

TElement

A class which implements ITableEntity.

Inheritance
TableQuery<TElement>
Implements
IQueryable<TElement>
IEnumerable<TElement>
Inherited Members
Extension Methods

Constructors

TableQuery()

Initializes a new instance of the TableQuery<TElement> class.

public TableQuery()

Properties

ElementType

Gets the type of the element(s) that are returned when the expression tree is executed.

public Type ElementType { get; }

Property Value

Type

A Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed.

Expression

Gets the expression tree.

public Expression Expression { get; }

Property Value

Expression

The Expression that is associated with this instance of IQueryable.

FilterString

Gets or sets the filter expression to use in the table query.

public string FilterString { get; set; }

Property Value

string

A string containing the filter expression to use in the query.

Provider

Gets the query provider that is associated with this data source.

public IQueryProvider Provider { get; }

Property Value

IQueryProvider

The IQueryProvider that is associated with this data source.

SelectColumns

Gets or sets the property names of the table entity properties to return when the table query is executed.

public IList<string> SelectColumns { get; set; }

Property Value

IList<string>

A list of strings containing the property names of the table entity properties to return when the query is executed.

TakeCount

Gets or sets the number of entities the query returns specified in the table query.

public int? TakeCount { get; set; }

Property Value

int?

The maximum number of entities for the table query to return.

Methods

BeginExecuteSegmented(TableContinuationToken, TableRequestOptions, OperationContext, AsyncCallback, object)

Begins an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginExecuteSegmented(TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)

Parameters

currentToken TableContinuationToken

A TableContinuationToken object returned by a previous listing operation. May be null.

requestOptions TableRequestOptions

A TableRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object that will be passed to the callback delegate.

Returns

ICancellableAsyncResult

An IAsyncResult that references the asynchronous operation.

BeginExecuteSegmented(TableContinuationToken, AsyncCallback, object)

Begins an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginExecuteSegmented(TableContinuationToken currentToken, AsyncCallback callback, object state)

Parameters

currentToken TableContinuationToken

A TableContinuationToken object returned by a previous listing operation. May be null.

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object that will be passed to the callback delegate.

Returns

ICancellableAsyncResult

An IAsyncResult that references the asynchronous operation.

Copy()

Creates a new copy of the TableQuery instance.

public TableQuery<TElement> Copy()

Returns

TableQuery<TElement>

A TableQuery instance.

EndExecuteSegmented(IAsyncResult)

Ends an asynchronous operation to execute a query and return the results as a result segment.

public virtual TableQuerySegment<TElement> EndExecuteSegmented(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

The reference to the pending asynchronous request to finish.

Returns

TableQuerySegment<TElement>

A TableQuerySegment<TElement> object of type TElement.

Execute(TableRequestOptions, OperationContext)

Executes a query on a table.

[DoesServiceRequest]
public virtual IEnumerable<TElement> Execute(TableRequestOptions requestOptions = null, OperationContext operationContext = null)

Parameters

requestOptions TableRequestOptions

A TableRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

IEnumerable<TElement>

An enumerable collection, specialized for type TElement, of the results of executing the query.

ExecuteSegmented(TableContinuationToken, TableRequestOptions, OperationContext)

Executes a segmented query against a table.

[DoesServiceRequest]
public virtual TableQuerySegment<TElement> ExecuteSegmented(TableContinuationToken continuationToken, TableRequestOptions requestOptions = null, OperationContext operationContext = null)

Parameters

continuationToken TableContinuationToken

A TableContinuationToken object representing a continuation token from the server when the operation returns a partial result.

requestOptions TableRequestOptions

A TableRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

TableQuerySegment<TElement>

A TableQuerySegment<TElement>, specialized for type TElement, containing the results of executing the query.

ExecuteSegmentedAsync(TableContinuationToken)

Initiates an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual Task<TableQuerySegment<TElement>> ExecuteSegmentedAsync(TableContinuationToken currentToken)

Parameters

currentToken TableContinuationToken

A continuation token returned by a previous listing operation, can be null.

Returns

Task<TableQuerySegment<TElement>>

A Task<TResult> of type TableQuerySegment<TElement> that represents the asynchronous operation.

ExecuteSegmentedAsync(TableContinuationToken, TableRequestOptions, OperationContext)

Initiates an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual Task<TableQuerySegment<TElement>> ExecuteSegmentedAsync(TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext)

Parameters

currentToken TableContinuationToken

A continuation token returned by a previous listing operation, can be null.

requestOptions TableRequestOptions

A TableRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

Task<TableQuerySegment<TElement>>

A Task<TResult> of type TableQuerySegment<TElement> that represents the asynchronous operation.

ExecuteSegmentedAsync(TableContinuationToken, TableRequestOptions, OperationContext, CancellationToken)

Initiates an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual Task<TableQuerySegment<TElement>> ExecuteSegmentedAsync(TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)

Parameters

currentToken TableContinuationToken

A continuation token returned by a previous listing operation, can be null.

requestOptions TableRequestOptions

A TableRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<TableQuerySegment<TElement>>

A Task<TResult> of type TableQuerySegment<TElement> that represents the asynchronous operation.

ExecuteSegmentedAsync(TableContinuationToken, CancellationToken)

Initiates an asynchronous operation to execute a query and return the results as a result segment.

[DoesServiceRequest]
public virtual Task<TableQuerySegment<TElement>> ExecuteSegmentedAsync(TableContinuationToken currentToken, CancellationToken cancellationToken)

Parameters

currentToken TableContinuationToken

A continuation token returned by a previous listing operation, can be null.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<TableQuerySegment<TElement>>

A Task<TResult> of type TableQuerySegment<TElement> that represents the asynchronous operation.

GetEnumerator()

Returns an enumerator that iterates through the TableQuery<TElement>.

public virtual IEnumerator<TElement> GetEnumerator()

Returns

IEnumerator<TElement>

An IEnumerator<T> for the TableQuery<TElement>.

Select(IList<string>)

Defines the property names of the table entity properties to return when the table query is executed.

public TableQuery<TElement> Select(IList<string> columns)

Parameters

columns IList<string>

A list of string objects containing the property names of the table entity properties to return when the query is executed.

Returns

TableQuery<TElement>

A TableQuery instance set with the table entity properties to return.

Remarks

The select clause is optional on a table query, and is used to limit the table properties returned from the server. By default, a query will return all properties from the table entity.

Take(int?)

Defines the upper bound for the number of entities the query returns.

public TableQuery<TElement> Take(int? take)

Parameters

take int?

The maximum number of entities for the table query to return.

Returns

TableQuery<TElement>

A TableQuery instance set with the number of entities to return.

Where(string)

Defines a filter expression for the table query. Only entities that satisfy the specified filter expression will be returned by the query.

public TableQuery<TElement> Where(string filter)

Parameters

filter string

A string containing the filter expression to apply to the table query.

Returns

TableQuery<TElement>

A TableQuery instance set with the filter on entities to return.

Remarks

Setting a filter expression is optional; by default, all entities in the table are returned if no filter expression is specified in the table query.