DocumentQueryable.CreateOfferQuery Method

 

Namespace:   Microsoft.Azure.Documents.Linq
Assembly:  Microsoft.Azure.Documents.Client (in Microsoft.Azure.Documents.Client.dll)

Overload List

Name Description
System_CAPS_pubmethodSystem_CAPS_static CreateOfferQuery(DocumentClient, FeedOptions)

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

System_CAPS_pubmethodSystem_CAPS_static CreateOfferQuery(DocumentClient, String, FeedOptions)

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

See Also

DocumentQueryable Class
Microsoft.Azure.Documents.Linq Namespace

Return to top

DocumentQueryable.CreateOfferQuery Method (DocumentClient, FeedOptions)

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

Syntax

public static IOrderedQueryable<Offer> CreateOfferQuery(
    this DocumentClient client,
    FeedOptions feedOptions = null
)
public:
[ExtensionAttribute]
static IOrderedQueryable<Offer^>^ CreateOfferQuery(
    DocumentClient^ client,
    FeedOptions^ feedOptions = null
)
<ExtensionAttribute>
Public Shared Function CreateOfferQuery (
    client As DocumentClient,
    feedOptions As FeedOptions
) As IOrderedQueryable(Of Offer)

Parameters

Return Value

Type: System.Linq.IOrderedQueryable<Offer>

An IOrderedQueryable{Offer} that can evaluate the query.

Remarks

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

Examples

This example below queries for offers

// Find the first collection with the S3 offer type
Offer offer = client.CreateOfferQuery().Where(o => o.OfferType == "S3").AsEnumerable().FirstOrDefault();

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

See Also

Offer
IDocumentQuery

Return to top

DocumentQueryable.CreateOfferQuery Method (DocumentClient, String, FeedOptions)

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

Syntax

public static IQueryable<object> CreateOfferQuery(
    this DocumentClient client,
    string sqlExpression,
    FeedOptions feedOptions = null
)
public:
[ExtensionAttribute]
static IQueryable<Object^>^ CreateOfferQuery(
    DocumentClient^ client,
    String^ sqlExpression,
    FeedOptions^ feedOptions = null
)
<ExtensionAttribute>
Public Shared Function CreateOfferQuery (
    client As DocumentClient,
    sqlExpression As String,
    feedOptions As FeedOptions
) As IQueryable(Of Object)

Parameters

Return Value

Type: System.Linq.IQueryable<Object>

an IQueryable{dynamic} that can evaluate the query.

Remarks

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

Examples

This example below queries for offers

// Find the first collection with the S3 offer type
Offer offer = client.CreateOfferQuery("SELECT * FROM offers o WHERE o.offerType = 'S3'").AsEnumerable().FirstOrDefault();

// 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();

See Also

Offer
IDocumentQuery

Return to top