Class ContainerDefinition<T>
Azure Cosmos container fluent definition.
public abstract class ContainerDefinition<T> where T : ContainerDefinition<T>
Type Parameters
T
- Inheritance
-
ContainerDefinition<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
ContainerDefinition()
Creates an instance for unit-testing
public ContainerDefinition()
- See Also
Methods
Build()
Applies the current Fluent definition and creates a container configuration.
public ContainerProperties Build()
Returns
- ContainerProperties
Builds the current Fluent configuration into an instance of ContainerProperties.
- See Also
WithDefaultTimeToLive(int)
DefaultTimeToLive will be applied to all the items in the container as the default time-to-live policy. The individual item could override the default time-to-live policy by setting its time to live.
public T WithDefaultTimeToLive(int defaultTtlInSeconds)
Parameters
defaultTtlInSeconds
intThe default Time To Live.
Returns
- T
An instance of the current Fluent builder.
- See Also
WithDefaultTimeToLive(TimeSpan)
DefaultTimeToLive will be applied to all the items in the container as the default time-to-live policy. The individual item could override the default time-to-live policy by setting its time to live.
public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan)
Parameters
defaultTtlTimeSpan
TimeSpanThe default Time To Live.
Returns
- T
An instance of the current Fluent builder.
- See Also
WithIndexingPolicy()
IndexingPolicy definition for the current Azure Cosmos container.
public IndexingPolicyDefinition<T> WithIndexingPolicy()
Returns
- IndexingPolicyDefinition<T>
An instance of IndexingPolicyDefinition<T>.
- See Also
WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion)
Sets the PartitionKeyDefinitionVersion
The partition key definition version 1 uses a hash function that computes hash based on the first 100 bytes of the partition key. This can cause conflicts for documents with partition keys greater than 100 bytes.
The partition key definition version 2 uses a hash function that computes hash based on the first 2 KB of the partition key.
public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion)
Parameters
partitionKeyDefinitionVersion
PartitionKeyDefinitionVersionThe partition key definition version
Returns
- T
An instance of the current Fluent builder.
- See Also
WithTimeToLivePropertyPath(string)
Sets the time to live base timestamp property path.
public T WithTimeToLivePropertyPath(string propertyPath)
Parameters
propertyPath
stringThis property should be only present when DefaultTimeToLive is set. When this property is present, time to live for a item is decided based on the value of this property in an item. By default, time to live is based on the _ts property in an item. Example: /property
Returns
- T
An instance of the current Fluent builder.
- See Also