CosmosDbKeyEscape.EscapeKey Method

Definition

Overloads

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.

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.

public static string EscapeKey (string key);
static member EscapeKey : string -> string
Public Shared Function EscapeKey (key As String) As String

Parameters

key
String

The key to escape.

Returns

An escaped key that can be used safely with CosmosDB.

Applies to

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.

public static string EscapeKey (string key, string suffix, bool compatibilityMode);
static member EscapeKey : string * string * bool -> string
Public Shared Function EscapeKey (key As String, suffix As String, compatibilityMode As Boolean) As String

Parameters

key
String

The key to escape.

suffix
String

The string to add at the end of all row keys.

compatibilityMode
Boolean

True if running in compatability mode and keys should be truncated in order to support previous CosmosDb max key length of 255. This behavior can be overridden by setting CompatibilityMode to false.

Returns

An escaped key that can be used safely with CosmosDB.

Applies to