Condividi tramite


CosmosUser.GetPermissionQueryIterator Method

Definition

Overloads

GetPermissionQueryIterator<T>(QueryDefinition, String, QueryRequestOptions, CancellationToken)

This method creates a query for permissions under a database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetPermissionQueryIterator<T>(String, String, QueryRequestOptions, CancellationToken)

This method creates a query for permission under a user using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetPermissionQueryIterator<T>(QueryDefinition, String, QueryRequestOptions, CancellationToken)

This method creates a query for permissions under a database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

public abstract Azure.AsyncPageable<T> GetPermissionQueryIterator<T> (Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Azure.Cosmos.QueryRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetPermissionQueryIterator : Azure.Cosmos.QueryDefinition * string * Azure.Cosmos.QueryRequestOptions * System.Threading.CancellationToken -> Azure.AsyncPageable<'T>
Public MustOverride Function GetPermissionQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of T)

Type Parameters

T

Parameters

queryDefinition
QueryDefinition

The cosmos SQL query definition.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the user query request QueryRequestOptions

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

An iterator to go through the permissions

Examples

This create the type feed iterator for permissions with queryDefinition as input.

string queryText = "SELECT * FROM c where c.id like @testId";
QueryDefinition queryDefinition = new QueryDefinition(queryText);
queryDefinition.WithParameter("@testId", "testPermissionId");
FeedIterator<PermissionProperties> resultSet = this.user.GetPermissionQueryIterator<PermissionProperties>(queryDefinition);
await foreach (PermissionProperties permissions in resultSet)
{
}

Remarks

Reading permissions will generate a new ResourceTokens. Prior ResourceTokens will still be valid.

Applies to

GetPermissionQueryIterator<T>(String, String, QueryRequestOptions, CancellationToken)

This method creates a query for permission under a user using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

public abstract Azure.AsyncPageable<T> GetPermissionQueryIterator<T> (string queryText = default, string continuationToken = default, Azure.Cosmos.QueryRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetPermissionQueryIterator : string * string * Azure.Cosmos.QueryRequestOptions * System.Threading.CancellationToken -> Azure.AsyncPageable<'T>
Public MustOverride Function GetPermissionQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of T)

Type Parameters

T

Parameters

queryText
String

The cosmos SQL query text.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the user query request QueryRequestOptions

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

An iterator to go through the permission

Examples

  1. This create the type feed iterator for permission with queryText as input,
string queryText = "SELECT * FROM c where c.id like '%testId%'";
FeedIterator<PermissionProperties> resultSet = this.users.GetPermissionQueryIterator<PermissionProperties>(queryText);
await foreach (PermissionProperties permissions in resultSet)
{
}
  1. This create the type feed iterator for permissions without queryText, retrieving all permissions.
FeedIterator<PermissionProperties> resultSet = this.user.GetPermissionQueryIterator<PermissionProperties>();
await foreach (PermissionProperties permissions in resultSet)
{
}

Applies to