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

Container.ReplaceContainerStreamAsync 方法

定义

ContainerProperties将 Azure Cosmos 服务中的 作为异步操作替换。

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

参数

requestOptions
ContainerRequestOptions

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

cancellationToken
CancellationToken

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

返回

包含TaskResponseMessage替换资源记录的 。

示例

https://aka.ms/cosmosdb-dot-net-exceptions#stream-api

ContainerProperties containerProperties = containerReadResponse;
containerProperties.IndexingPolicy.Automatic = false;
ResponseMessage response = await container.ReplaceContainerStreamAsync(containerProperties);

适用于