Share via


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

Database.CreateContainerStreamAsync 方法

定义

重载

CreateContainerStreamAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

在 Azure Cosmos 服务中将容器创建为异步操作。

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

在 Azure Cosmos 服务中将容器创建为异步操作。

CreateContainerStreamAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

在 Azure Cosmos 服务中将容器创建为异步操作。

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage> CreateContainerStreamAsync (Microsoft.Azure.Cosmos.ContainerProperties containerProperties, Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateContainerStreamAsync : Microsoft.Azure.Cosmos.ContainerProperties * Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>
Public MustOverride Function CreateContainerStreamAsync (containerProperties As ContainerProperties, throughputProperties As ThroughputProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResponseMessage)

参数

containerProperties
ContainerProperties

ContainerProperties 对象。

throughputProperties
ThroughputProperties

(可选) 为容器预配的吞吐量,以测量 Azure Cosmos DB 服务中的每秒请求单位数。

requestOptions
RequestOptions

(可选) 容器请求的选项。

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

一个 TaskResponseMessage ,包含包含所创建资源记录的 。

示例

在 Azure Cosmos 服务中创建容器作为异步操作并返回流响应。

ContainerProperties containerProperties = new ContainerProperties()
{
    Id = Guid.NewGuid().ToString(),
    PartitionKeyPath = "/pk",
};

using(ResponseMessage response = await this.cosmosDatabase.CreateContainerStreamAsync(
    containerProperties,
    ThroughputProperties.CreateAutoscaleThroughput(10000)))
{
}

另请参阅

适用于

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

在 Azure Cosmos 服务中将容器创建为异步操作。

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage> CreateContainerStreamAsync (Microsoft.Azure.Cosmos.ContainerProperties containerProperties, int? throughput = default, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateContainerStreamAsync : Microsoft.Azure.Cosmos.ContainerProperties * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>
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 ResponseMessage)

参数

containerProperties
ContainerProperties

ContainerProperties 对象。

throughput
Nullable<Int32>

(可选) 为容器预配的吞吐量,以测量 Azure Cosmos DB 服务中的每秒请求单位数。

requestOptions
RequestOptions

(可选) 容器请求的选项。

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

一个 TaskResponseMessage ,包含包含所创建资源记录的 。

示例

在 Azure Cosmos 服务中创建容器作为异步操作并返回流响应。

ContainerProperties containerProperties = new ContainerProperties()
{
    Id = Guid.NewGuid().ToString(),
    PartitionKeyPath = "/pk",
};

using(ResponseMessage response = await this.cosmosDatabase.CreateContainerStreamAsync(containerProperties))
{
}

注解

https://docs.microsoft.com/azure/cosmos-db/request-units 有关预配吞吐量的详细信息。

另请参阅

适用于