你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
CosmosDatabase.CreateContainerStreamAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在 Azure Cosmos 服务中将容器创建为异步操作。
public abstract System.Threading.Tasks.Task<Azure.Response> CreateContainerStreamAsync (Azure.Cosmos.ContainerProperties containerProperties, int? throughput = default, Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateContainerStreamAsync : Azure.Cosmos.ContainerProperties * Nullable<int> * Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public MustOverride Function CreateContainerStreamAsync (containerProperties As ContainerProperties, Optional throughput As Nullable(Of Integer) = Nothing, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)
参数
- containerProperties
- ContainerProperties
- requestOptions
- RequestOptions
(可选) 容器请求的选项 RequestOptions
- cancellationToken
- CancellationToken
(表示请求取消的可选) CancellationToken 。
返回
示例
在 Azure Cosmos 服务中创建一个容器作为异步操作,并返回流响应。
ContainerProperties containerProperties = new ContainerProperties()
{
Id = Guid.NewGuid().ToString(),
PartitionKeyPath = "/pk",
};
using(Response response = await this.cosmosDatabase.CreateContainerStreamAsync(containerProperties))
{
}
注解
https://docs.microsoft.com/azure/cosmos-db/request-units 有关预配吞吐量的详细信息。