Share via


CosmosQueryableExtensions.WithPartitionKey<TEntity> Method

Definition

Specify the partition key for partition used for the query. Required when using a resource token that provides permission based on a partition key for authentication,

public static System.Linq.IQueryable<TEntity> WithPartitionKey<TEntity> (this System.Linq.IQueryable<TEntity> source, string partitionKey) where TEntity : class;
static member WithPartitionKey : System.Linq.IQueryable<'Entity (requires 'Entity : null)> * string -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function WithPartitionKey(Of TEntity As Class) (source As IQueryable(Of TEntity), partitionKey As String) As IQueryable(Of TEntity)

Type Parameters

TEntity

The type of entity being queried.

Parameters

source
IQueryable<TEntity>

The source query.

partitionKey
String

The partition key.

Returns

IQueryable<TEntity>

A new query with the set partition key.

Remarks

See Querying data with EF Core, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to