CosmosDbKeyEscape Class

Definition

Helper methods for escaping keys used for Cosmos DB.

public static class CosmosDbKeyEscape
type CosmosDbKeyEscape = class
Public Class CosmosDbKeyEscape
Inheritance
CosmosDbKeyEscape

Fields

MaxKeyLength

Older libraries had a max key length of 255. The limit is now 1023. In this library, 255 remains the default for backwards compat. To override this behavior, and use the longer limit, set CosmosDbPartitionedStorageOptions.CompatibilityMode to false. https://docs.microsoft.com/en-us/azure/cosmos-db/concepts-limits#per-item-limits.

Methods

EscapeKey(String)

Converts the key into a DocumentID that can be used safely with Cosmos DB. The following characters are restricted and cannot be used in the Id property: '/', '', '?', and '#'. More information at https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet.

EscapeKey(String, String, Boolean)

Converts the key into a DocumentID that can be used safely with Cosmos DB. The following characters are restricted and cannot be used in the Id property: '/', '', '?', and '#'. More information at https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet.

Applies to