Resource.Id Property

Definition

Gets or sets the Id of the resource in the Azure DocumentDB database service.

[Newtonsoft.Json.JsonProperty(PropertyName="id")]
public virtual string Id { get; set; }
Property Value

The Id associated with the resource.

Remarks

Every resource within an Azure DocumentDB database account needs to have a unique identifier. Unlike ResourceId, which is set internally, this Id is settable by the user and is not immutable.

When working with document resources, they too have this settable Id property. If an Id is not supplied by the user the SDK will automatically generate a new GUID and assign its value to this property before persisting the document in the database. You can override this auto Id generation by setting the disableAutomaticIdGeneration parameter on the DocumentClient instance to true. This will prevent the SDK from generating new Ids.

The following characters are restricted and cannot be used in the Id property: '/', '\', '?', '#'