你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CosmosClient.GetDatabase(String) 方法

定义

返回对数据库的代理引用。

public virtual Azure.Cosmos.CosmosDatabase GetDatabase (string id);
abstract member GetDatabase : string -> Azure.Cosmos.CosmosDatabase
override this.GetDatabase : string -> Azure.Cosmos.CosmosDatabase
Public Overridable Function GetDatabase (id As String) As CosmosDatabase

参数

id
String

cosmos 数据库 ID

返回

Cosmos 数据库代理

示例

Database db = cosmosClient.GetDatabase("myDatabaseId"];
DatabaseResponse response = await db.ReadAsync();

注解

CosmosDatabase 代理引用不保证存在。

适用于