Search documentationEsc

ContainerOptionsBuilder

Options for a container

Namespace: Microsoft.Azure.CosmosRepository.Builders
Kind: class

Options for a container

public class ContainerOptionsBuilder

Remarks

Creates an instance of ContainerOptionsBuilder.

Example

Members

Constructor

ContainerOptionsBuilder.ContainerOptionsBuilder(Type)

Options for a container

public ContainerOptionsBuilder(Type type)

Parameters

NameTypeDescription
typeTypeThe type of IItem the options are for.

Creates an instance of ContainerOptionsBuilder.

Methods

ContainerOptionsBuilder.WithContainerDefaultTimeToLive(TimeSpan)

Sets the ContainerDefaultTimeToLive for a container.

public ContainerOptionsBuilder WithContainerDefaultTimeToLive(TimeSpan containerDefaultTimeToLive)

Parameters

NameTypeDescription
containerDefaultTimeToLiveTimeSpanThe default time to live for the container.

Returns — ContainerOptionsBuilder

ContainerOptionsBuilder.WithContainer(string)

Sets the Name of the container

public ContainerOptionsBuilder WithContainer(string name)

Parameters

NameTypeDescription
nameStringThe name of the container

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

ContainerOptionsBuilder.WithPartitionKey(string)

Sets the partition key for the container

public ContainerOptionsBuilder WithPartitionKey(string partitionKey)

Parameters

NameTypeDescription
partitionKeyStringThe partition key for the container

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

ContainerOptionsBuilder.WithSyncableContainerProperties()

Sets SyncContainerProperties to true

public ContainerOptionsBuilder WithSyncableContainerProperties()

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

ContainerOptionsBuilder.WithManualThroughput(int)

Sets the container for this IItem to use a manual throughput value.

public ContainerOptionsBuilder WithManualThroughput(int throughput = 400)

Parameters

NameTypeDescription
throughputInt32The RU/s that this container can utilise.

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

This value must be at least 400 RU/s.

ContainerOptionsBuilder.WithAutoscaleThroughput(int)

Sets the container for this IItem to use a autoscale throughput value.

public ContainerOptionsBuilder WithAutoscaleThroughput(int maxAutoScaleThroughput = 1000)

Parameters

NameTypeDescription
maxAutoScaleThroughputInt32The maximum RU/s that this containers throughput can autoscale to.

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

If a container has already been created without specifying a throughput then it cannot be updated.

ContainerOptionsBuilder.WithServerlessThroughput()

When your Cosmos DB resource is

configured for serverless, your containers must explicitly set serverless ThroughputProperties.

public ContainerOptionsBuilder WithServerlessThroughput()

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

ContainerOptionsBuilder.WithChangeFeedMonitoring(Action<ChangeFeedOptions>?)

Adds monitoring of the change feed for the given IItem

public ContainerOptionsBuilder WithChangeFeedMonitoring(Action<ChangeFeedOptions>? optionsActions = null)

Parameters

NameTypeDescription
optionsActionsChangeFeedOptions}An action to configure the change feed for the given container.

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

The options configured here are for the container, not just the IItem be aware if item’s share a container they will share the same change feed options.

ContainerOptionsBuilder.WithoutStrictTypeChecking()

Configures the given IItem’s queries to not check for the Type field.

public ContainerOptionsBuilder WithoutStrictTypeChecking()

Returns — ContainerOptionsBuilder: Instance of ContainerOptionsBuilder

This is useful in scenarios where you have a sub types that will deserialize into a base type.