共用方式為


DocumentClient.CreatePermissionQuery Method

Definition

Overloads

CreatePermissionQuery(Uri, String, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

CreatePermissionQuery(String, String, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB database using a SQL statement. It returns IQueryable{dynamic}.

CreatePermissionQuery(Uri, SqlQuerySpec, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

CreatePermissionQuery(Uri, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

CreatePermissionQuery(String, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB service. It returns IOrderedQueryable{Permission}.

CreatePermissionQuery(String, SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB database using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.

CreatePermissionQuery(Uri, String, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

public System.Linq.IQueryable<dynamic> CreatePermissionQuery (Uri permissionsUri, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreatePermissionQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreatePermissionQuery (permissionsUri As Uri, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

permissionsUri
Uri

the URI to the permissions.

sqlExpression
String

The sql query.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreatePermissionQuery(String, String, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB database using a SQL statement. It returns IQueryable{dynamic}.

public System.Linq.IQueryable<dynamic> CreatePermissionQuery (string permissionsLink, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreatePermissionQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreatePermissionQuery (permissionsLink As String, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

permissionsLink
String

The path link for the persmissions under a user, e.g. dbs/db_rid/users/user_rid/permissions/.

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.

Implements

Examples

This example below queries for permissions by id.

Permission perm = client.CreatePermissionQuery(userLink, 
    "SELECT * FROM perms p WHERE p.id = 'readonly'").AsEnumerable().FirstOrDefault();

Remarks

Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to

CreatePermissionQuery(Uri, SqlQuerySpec, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

public System.Linq.IQueryable<dynamic> CreatePermissionQuery (Uri permissionsUri, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreatePermissionQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreatePermissionQuery (permissionsUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

permissionsUri
Uri

the URI to the permissions.

querySpec
SqlQuerySpec

The sql query.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreatePermissionQuery(Uri, FeedOptions)

Extension method to create a query for permissions in the Azure Cosmos DB service.

public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission> CreatePermissionQuery (Uri permissionsUri, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission>
override this.CreatePermissionQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission>
Public Function CreatePermissionQuery (permissionsUri As Uri, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of Permission)

Parameters

permissionsUri
Uri

the URI to the permissions.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreatePermissionQuery(String, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB service. It returns IOrderedQueryable{Permission}.

public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission> CreatePermissionQuery (string permissionsLink, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission>
override this.CreatePermissionQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Permission>
Public Function CreatePermissionQuery (permissionsLink As String, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of Permission)

Parameters

permissionsLink
String

The path link for the persmissions under a user, e.g. dbs/db_rid/users/user_rid/permissions/.

feedOptions
FeedOptions

The options for processing the query result feed. For details, see FeedOptions

Returns

An IOrderedQueryable{Permission} that can evaluate the query.

Implements

Examples

This example below queries for permissions by id.

Permission perm = client.CreatePermissionQuery(userLink).Where(p => p.id == "readonly").AsEnumerable().FirstOrDefault();

See also

Applies to

CreatePermissionQuery(String, SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for permissions under a user in an Azure Cosmos DB database using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.

public System.Linq.IQueryable<dynamic> CreatePermissionQuery (string permissionsLink, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreatePermissionQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreatePermissionQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreatePermissionQuery (permissionsLink As String, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

permissionsLink
String

The path link for the persmissions under a user, e.g. dbs/db_rid/users/user_rid/permissions/.

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.

Implements

Examples

This example below queries for permissions by id.

var query = new SqlQuerySpec(
    "SELECT * FROM perms p WHERE p.id = @id", 
    new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@id", Value = "readonly" }}));

Permission perm = client.CreatePermissionQuery(usersLink, query).AsEnumerable().FirstOrDefault();

Remarks

Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to