Search documentationEsc

PartitionKeyPathAttribute

The partition key path attribute exposes the ability to declaratively

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

The partition key path attribute exposes the ability to declaratively specify an IItem partition key path. This attribute should be used in conjunction with a JsonPropertyAttribute on the IItem property whose value will act as the partition key. Partition key paths should start with ”/”, for example “/partition”. For more information, see https://learn.microsoft.com/azure/cosmos-db/partitioning-overview.

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class PartitionKeyPathAttribute : Attribute

Remarks

By default, “/id” is used.

Example

Members

Constructor

PartitionKeyPathAttribute.PartitionKeyPathAttribute(string)

The partition key path attribute exposes the ability to declaratively specify an IItem partition key path. This attribute should be used in conjunction with a JsonPropertyAttribute on the IItem property whose value will act as the partition key. Partition key paths should start with ”/”, for example “/partition”. For more information, see https://learn.microsoft.com/azure/cosmos-db/partitioning-overview.

public PartitionKeyPathAttribute(string path)

Parameters

NameTypeDescription
pathString

By default, “/id” is used.

Property

PartitionKeyPathAttribute.Path

Gets the path of the parition key.

public string Path { get; }

ReturnsString