Bagikan melalui


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 = default);
abstract member CreateOfferQuery : Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Offer>
Public Function CreateOfferQuery (Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of 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://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to

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 = default);
abstract member CreateOfferQuery : Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateOfferQuery (querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

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://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to

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 = default);
abstract member CreateOfferQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateOfferQuery (sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

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://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to