共用方式為


Database Class

Definition

Operations for reading or deleting an existing database.

See Client for creating new databases, and reading/querying all databases; use client.Databases.

public abstract class Database
type Database = class
Public MustInherit Class Database
Inheritance
Database

Remarks

Note: all these operations make calls against a fixed budget. You should design your system such that these calls scale sub-linearly with your application. For instance, do not call `database.ReadAsync()` before every single `container.ReadItemAsync()` call to ensure the database exists; do this once on application start up.

Constructors

Database()

Properties

Client

The parent Cosmos client instance related the database instance

Id

The Id of the Cosmos database

Methods

CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties, RequestOptions, CancellationToken)

Saves the client encryption key as an asynchronous operation in the Azure Cosmos service. This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.

CreateContainerAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerIfNotExistsAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Check if a container exists, and if it doesn't, create it. Only the container id is used to verify if there is an existing container. Other container properties such as throughput are not validated and can be different then the passed properties.

CreateContainerIfNotExistsAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

Check if a container exists, and if it doesn't, create it. Only the container id is used to verify if there is an existing container. Other container properties such as throughput are not validated and can be different then the passed properties.

CreateContainerIfNotExistsAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken)

Check if a container exists, and if it doesn't, create it. This will make a read operation, and if the container is not found it will do a create operation.

CreateContainerStreamAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerStreamAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateUserAsync(String, RequestOptions, CancellationToken)

Creates a user as an asynchronous operation in the Azure Cosmos service.

DefineContainer(String, String)

Creates a containerBuilder.

DeleteAsync(RequestOptions, CancellationToken)

Delete a Database from the Azure Cosmos DB service as an asynchronous operation.

DeleteStreamAsync(RequestOptions, CancellationToken)

Delete a DatabaseProperties from the Azure Cosmos DB service as an asynchronous operation.

GetClientEncryptionKey(String)

Returns a reference to a client encryption key object. This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.

GetClientEncryptionKeyQueryIterator(QueryDefinition, String, QueryRequestOptions)

Returns an iterator that can be iterated to get properties of client encryption keys. This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.

GetContainer(String)

Returns a reference to a container object.

GetContainerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

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

GetContainerQueryIterator<T>(String, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator.

GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

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

GetContainerQueryStreamIterator(String, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator.

GetUser(String)

Returns a reference to a user object.

GetUserQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

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

GetUserQueryIterator<T>(String, String, QueryRequestOptions)

This method creates a query for users under an database using a SQL statement. It returns a FeedIterator.

ReadAsync(RequestOptions, CancellationToken)

Reads a DatabaseResponse from the Azure Cosmos service as an asynchronous operation.

ReadStreamAsync(RequestOptions, CancellationToken)

Reads a DatabaseProperties from the Azure Cosmos service as an asynchronous operation.

ReadThroughputAsync(CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReadThroughputAsync(RequestOptions, CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

Sets throughput provisioned for a database in measurement of request units per second in the Azure Cosmos service.

ReplaceThroughputAsync(ThroughputProperties, RequestOptions, CancellationToken)

Sets throughput provisioned for a database in measurement of request units per second in the Azure Cosmos service.

UpsertUserAsync(String, RequestOptions, CancellationToken)

Upserts a user as an asynchronous operation in the Azure Cosmos service.

Applies to