Sdílet prostřednictvím


Database.CreateContainerStreamAsync Method

Definition

Overloads

CreateContainerStreamAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

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

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

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

CreateContainerStreamAsync(ContainerProperties, ThroughputProperties, RequestOptions, CancellationToken)

Source:
Database.cs

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

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)

Parameters

containerProperties
ContainerProperties

The ContainerProperties object.

throughputProperties
ThroughputProperties

(Optional) The throughput provisioned for a container in measurement of Request Units per second in the Azure Cosmos DB service.

requestOptions
RequestOptions

(Optional) The options for the container request.

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

A Task containing a ResponseMessage containing the created resource record.

Examples

Creates a container as an asynchronous operation in the Azure Cosmos service and return stream response.

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

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

See also

Applies to

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

Source:
Database.cs

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

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)

Parameters

containerProperties
ContainerProperties

The ContainerProperties object.

throughput
Nullable<Int32>

(Optional) The throughput provisioned for a container in measurement of Request Units per second in the Azure Cosmos DB service.

requestOptions
RequestOptions

(Optional) The options for the container request.

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

A Task containing a ResponseMessage containing the created resource record.

Examples

Creates a container as an asynchronous operation in the Azure Cosmos service and return stream response.

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

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

See also

Applies to