CosmosDbKeyEscape.EscapeKey 方法

定义

重载

EscapeKey(String)

将密钥转换为可与 Cosmos DB 一起安全使用的 DocumentID。 以下字符受到限制,不能在 Id 属性中使用:“/”、“”、“?”和“#”。 有关详细信息,请参阅 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet

EscapeKey(String, String, Boolean)

将密钥转换为可与 Cosmos DB 一起安全使用的 DocumentID。 以下字符受到限制,不能在 Id 属性中使用:“/”、“”、“?”和“#”。 有关详细信息,请参阅 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet

EscapeKey(String)

将密钥转换为可与 Cosmos DB 一起安全使用的 DocumentID。 以下字符受到限制,不能在 Id 属性中使用:“/”、“”、“?”和“#”。 有关详细信息,请参阅 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

参数

key
String

要转义的键。

返回

可与 CosmosDB 一起安全使用的转义密钥。

适用于

EscapeKey(String, String, Boolean)

将密钥转换为可与 Cosmos DB 一起安全使用的 DocumentID。 以下字符受到限制,不能在 Id 属性中使用:“/”、“”、“?”和“#”。 有关详细信息,请参阅 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

参数

key
String

要转义的键。

suffix
String

要在所有行键末尾添加的字符串。

compatibilityMode
Boolean

如果在兼容模式下运行,则应截断密钥,以支持以前的 CosmosDb 最大密钥长度为 255,则为 True。 可以通过将 设置为 CompatibilityMode false 来重写此行为。

返回

可与 CosmosDB 一起安全使用的转义密钥。

适用于