IDocumentClient.CreateOfferQuery Method

Definition

Overloads

CreateOfferQuery(FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account. It returns IOrderedQueryable{Offer}.

CreateOfferQuery(SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account using a SQL statement with parameterized values. It returns IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.

CreateOfferQuery(String, FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account using a SQL statement. It returns IQueryable{dynamic}.

CreateOfferQuery(FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account. It returns IOrderedQueryable{Offer}.

public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Offer> CreateOfferQuery (Microsoft.Azure.Documents.Client.FeedOptions feedOptions = null);
abstract member CreateOfferQuery : Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Offer>

Parameters

feedOptions
FeedOptions

The options for processing the query result feed. For details, see FeedOptions

Returns

An IOrderedQueryable{Offer} that can evaluate the query.

Examples

This example below queries for offers


// Find the offer for the collection by SelfLink
Offer offer = client.CreateOfferQuery().Where(o => o.Resource == collection.SelfLink);

// Find the offer for the database by SelfLink
Offer offer = client.CreateOfferQuery().Where(o => o.Resource == database.SelfLink);

Remarks

Refer to https://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and http://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

See also

CreateOfferQuery(SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account using a SQL statement with parameterized values. It returns IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.

public System.Linq.IQueryable<dynamic> CreateOfferQuery (Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = null);
abstract member CreateOfferQuery : Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

Parameters

querySpec
SqlQuerySpec

The SqlQuerySpec instance containing the SQL expression.

feedOptions
FeedOptions

The options for processing the query result feed. For details, see FeedOptions

Returns

an IQueryable{dynamic} that can evaluate the query.

Examples

This example below queries for offers


// Find the offer for the collection by SelfLink
Offer offer = client.CreateOfferQuery("SELECT * FROM offers o WHERE o.resource = @collectionSelfLink",
new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@collectionSelfLink", Value = collection.SelfLink }}))
.AsEnumerable().FirstOrDefault();

Remarks

Refer to https://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and http://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

See also

CreateOfferQuery(String, FeedOptions)

Overloaded. This method creates a query for offers under an Azure Cosmos DB database account using a SQL statement. It returns IQueryable{dynamic}.

public System.Linq.IQueryable<dynamic> CreateOfferQuery (string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = null);
abstract member CreateOfferQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

Parameters

sqlExpression
String

The SQL statement.

feedOptions
FeedOptions

The options for processing the query result feed. For details, see FeedOptions

Returns

an IQueryable{dynamic} that can evaluate the query.

Examples

This example below queries for offers


// Find the offer for the collection by SelfLink
Offer offer = client.CreateOfferQuery(
    string.Format("SELECT * FROM offers o WHERE o.resource = '{0}'", collectionSelfLink)).AsEnumerable().FirstOrDefault();

Remarks

Refer to https://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and http://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

See also

Applies to