Table of Contents

Class TableQuery

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

Represents a query against a specified table.

public class TableQuery
Inheritance
TableQuery
Inherited Members

Constructors

TableQuery()

Represents a query against a specified table.

public TableQuery()

Remarks

A TableQuery instance aggregates the query parameters to use when the query is executed. One of the executeQuery or executeQuerySegmented methods of CloudTableClient must be called to execute the query. The parameters are encoded and passed to the server when the table query is executed.

Properties

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.

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 table query will return.

public int? TakeCount { get; set; }

Property Value

int?

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

Methods

CombineFilters(string, string, string)

Creates a filter condition using the specified logical operator on two filter conditions.

public static string CombineFilters(string filterA, string operatorString, string filterB)

Parameters

filterA string

A string containing the first formatted filter condition.

operatorString string

A string containing the operator to use (AND, OR).

filterB string

A string containing the second formatted filter condition.

Returns

string

A string containing the combined filter expression.

Copy()

Make a shallow copy of this TableQuery object.

public TableQuery Copy()

Returns

TableQuery

The newly created shallow copy.

GenerateFilterCondition(string, string, string)

Generates a property filter condition string for the string value.

public static string GenerateFilterCondition(string propertyName, string operation, string givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue string

A string containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForBinary(string, string, byte[])

Generates a property filter condition string for the binary value.

public static string GenerateFilterConditionForBinary(string propertyName, string operation, byte[] givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue byte[]

A byte array containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForBool(string, string, bool)

Generates a property filter condition string for the boolean value.

public static string GenerateFilterConditionForBool(string propertyName, string operation, bool givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue bool

A bool containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForDate(string, string, DateTimeOffset)

Generates a property filter condition string for the DateTimeOffset value.

public static string GenerateFilterConditionForDate(string propertyName, string operation, DateTimeOffset givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue DateTimeOffset

A DateTimeOffset containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForDouble(string, string, double)

Generates a property filter condition string for the double value.

public static string GenerateFilterConditionForDouble(string propertyName, string operation, double givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue double

A double containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForGuid(string, string, Guid)

Generates a property filter condition string for the Guid value.

public static string GenerateFilterConditionForGuid(string propertyName, string operation, Guid givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue Guid

A Guid containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForInt(string, string, int)

Generates a property filter condition string for an int value.

public static string GenerateFilterConditionForInt(string propertyName, string operation, int givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue int

An int containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

GenerateFilterConditionForLong(string, string, long)

Generates a property filter condition string for an long value.

public static string GenerateFilterConditionForLong(string propertyName, string operation, long givenValue)

Parameters

propertyName string

A string containing the name of the property to compare.

operation string

A string containing the comparison operator to use.

givenValue long

An long containing the value to compare with the property.

Returns

string

A string containing the formatted filter condition.

Project<T>(T, params string[])

Specifies the names of the entity properties to return when the query is executed against the table.

public static T Project<T>(T entity, params string[] columns)

Parameters

entity T

The entity instance to project off of.

columns string[]

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

Returns

T

A TableQuery instance set with the entity properties to return.

Type Parameters

T

The entity type of the query.

Remarks

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

Select(IList<string>)

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

public TableQuery 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

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

Remarks

The select clause is optional on a table query, 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 Take(int? take)

Parameters

take int?

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

Returns

TableQuery

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 Where(string filter)

Parameters

filter string

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

Returns

TableQuery

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.