Share via


CosmosLinqExtensions.ToQueryDefinition<T>(IQueryable<T>) Method

Definition

This method generate query definition from LINQ query.

public static Microsoft.Azure.Cosmos.QueryDefinition ToQueryDefinition<T> (this System.Linq.IQueryable<T> query);
static member ToQueryDefinition : System.Linq.IQueryable<'T> -> Microsoft.Azure.Cosmos.QueryDefinition
<Extension()>
Public Function ToQueryDefinition(Of T) (query As IQueryable(Of T)) As QueryDefinition

Type Parameters

T

the type of object to query.

Parameters

query
IQueryable<T>

the IQueryable{T} to be converted.

Returns

The queryDefinition which can be used in query execution.

Examples

This example shows how to generate query definition from LINQ.

IQueryable<T> queryable = container.GetItemsQueryIterator<T>(allowSynchronousQueryExecution = true)
                     .Where(t => b.id.contains("test"));
QueryDefinition queryDefinition = queryable.ToQueryDefinition();

Applies to