DocumentClient Constructors

Definition

Overloads

DocumentClient(Uri, IDictionary<String,String>, ConnectionPolicy, Nullable<ConsistencyLevel>)
Obsolete.

Initializes a new instance of the Microsoft.Azure.Documents.Client.DocumentClient class using the specified Azure Cosmos DB service endpoint, a dictionary of resource tokens and a connection policy.

DocumentClient(Uri, IList<Permission>, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint for the Azure Cosmos DB service, a list of permission objects and a connection policy.

DocumentClient(Uri, SecureString, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, and connection policy for the Azure Cosmos DB service.

DocumentClient(Uri, String, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token) and a connection policy for the Azure Cosmos DB service.

DocumentClient(Uri, SecureString, ConnectionPolicy, Nullable<ConsistencyLevel>, JsonSerializerSettings)
Obsolete.

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

DocumentClient(Uri, SecureString, JsonSerializerSettings, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

DocumentClient(Uri, String, ConnectionPolicy, Nullable<ConsistencyLevel>, JsonSerializerSettings)
Obsolete.

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token), a connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

DocumentClient(Uri, String, JsonSerializerSettings, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token), a connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

DocumentClient(Uri, String, HttpMessageHandler, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token) and a connection policy for the Azure Cosmos DB service.

DocumentClient(Uri, IDictionary<String,String>, ConnectionPolicy, Nullable<ConsistencyLevel>)

Caution

Please use the constructor that takes a permission list or a resource token list.

Initializes a new instance of the Microsoft.Azure.Documents.Client.DocumentClient class using the specified Azure Cosmos DB service endpoint, a dictionary of resource tokens and a connection policy.

[System.Obsolete("Please use the constructor that takes a permission list or a resource token list.")]
public DocumentClient (Uri serviceEndpoint, System.Collections.Generic.IDictionary<string,string> resourceTokens, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
[<System.Obsolete("Please use the constructor that takes a permission list or a resource token list.")>]
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * System.Collections.Generic.IDictionary<string, string> * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, resourceTokens As IDictionary(Of String, String), Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

resourceTokens
IDictionary<String,String>

A dictionary of resource ids and resource tokens.

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) The default consistency policy for client operations.

Attributes

Remarks

Using Direct connectivity, wherever possible, is recommended

See also

Applies to

DocumentClient(Uri, IList<Permission>, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint for the Azure Cosmos DB service, a list of permission objects and a connection policy.

public DocumentClient (Uri serviceEndpoint, System.Collections.Generic.IList<Microsoft.Azure.Documents.Permission> permissionFeed, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * System.Collections.Generic.IList<Microsoft.Azure.Documents.Permission> * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, permissionFeed As IList(Of Permission), Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

permissionFeed
IList<Permission>

A list of Permission objects to use to create the client.

connectionPolicy
ConnectionPolicy

(Optional) The ConnectionPolicy to use for this connection.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) The default consistency policy for client operations.

Exceptions

If permissionFeed is not supplied.

If permissionFeed is not a valid permission link.

Remarks

If no connectionPolicy is provided, then the default ConnectionPolicy will be used. Using Direct connectivity, wherever possible, is recommended.

See also

Applies to

DocumentClient(Uri, SecureString, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, and connection policy for the Azure Cosmos DB service.

public DocumentClient (Uri serviceEndpoint, System.Security.SecureString authKey, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * System.Security.SecureString * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKey As SecureString, Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKey
SecureString

The list of Permission objects to use to create the client.

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client. If none is passed, the default is used ConnectionPolicy

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) This can be used to weaken the database account consistency level for read operations. If this is not set the database account consistency level will be used for all requests.

Remarks

The service endpoint and the authorization key can be obtained from the Azure Management Portal. The authKey used here is encrypted for privacy when being used, and deleted from computer memory when no longer needed

Using Direct connectivity, wherever possible, is recommended

See also

Applies to

DocumentClient(Uri, String, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token) and a connection policy for the Azure Cosmos DB service.

public DocumentClient (Uri serviceEndpoint, string authKeyOrResourceToken, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * string * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKeyOrResourceToken As String, Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKeyOrResourceToken
String

The authorization key or resource token to use to create the client.

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) The default consistency policy for client operations.

Remarks

The service endpoint can be obtained from the Azure Management Portal. If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal If however you are connecting as a specific Azure Cosmos DB User, the value passed to authKeyOrResourceToken is the ResourceToken obtained from the permission feed for the user.

Using Direct connectivity, wherever possible, is recommended.

See also

Applies to

DocumentClient(Uri, SecureString, ConnectionPolicy, Nullable<ConsistencyLevel>, JsonSerializerSettings)

Caution

Please use the constructor that takes JsonSerializerSettings as the third parameter.

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

[System.Obsolete("Please use the constructor that takes JsonSerializerSettings as the third parameter.")]
public DocumentClient (Uri serviceEndpoint, System.Security.SecureString authKey, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel, Newtonsoft.Json.JsonSerializerSettings serializerSettings);
[<System.Obsolete("Please use the constructor that takes JsonSerializerSettings as the third parameter.")>]
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * System.Security.SecureString * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> * Newtonsoft.Json.JsonSerializerSettings -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKey As SecureString, connectionPolicy As ConnectionPolicy, desiredConsistencyLevel As Nullable(Of ConsistencyLevel), serializerSettings As JsonSerializerSettings)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKey
SecureString

The list of Permission objects to use to create the client.

connectionPolicy
ConnectionPolicy

The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

This can be used to weaken the database account consistency level for read operations. If this is not set the database account consistency level will be used for all requests.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings

The custom JsonSerializer settings to be used for serialization/derialization.

Attributes

Remarks

The service endpoint and the authorization key can be obtained from the Azure Management Portal. The authKey used here is encrypted for privacy when being used, and deleted from computer memory when no longer needed

Using Direct connectivity, wherever possible, is recommended

See also

Applies to

DocumentClient(Uri, SecureString, JsonSerializerSettings, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified Azure Cosmos DB service endpoint, key, connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

public DocumentClient (Uri serviceEndpoint, System.Security.SecureString authKey, Newtonsoft.Json.JsonSerializerSettings serializerSettings, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * System.Security.SecureString * Newtonsoft.Json.JsonSerializerSettings * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKey As SecureString, serializerSettings As JsonSerializerSettings, Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKey
SecureString

The list of Permission objects to use to create the client.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings

The custom JsonSerializer settings to be used for serialization/derialization.

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client. If none is passed, the default is used ConnectionPolicy

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) This can be used to weaken the database account consistency level for read operations. If this is not set the database account consistency level will be used for all requests.

Remarks

The service endpoint and the authorization key can be obtained from the Azure Management Portal. The authKey used here is encrypted for privacy when being used, and deleted from computer memory when no longer needed

Using Direct connectivity, wherever possible, is recommended

See also

Applies to

DocumentClient(Uri, String, ConnectionPolicy, Nullable<ConsistencyLevel>, JsonSerializerSettings)

Caution

Please use the constructor that takes JsonSerializerSettings as the third parameter.

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token), a connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

[System.Obsolete("Please use the constructor that takes JsonSerializerSettings as the third parameter.")]
public DocumentClient (Uri serviceEndpoint, string authKeyOrResourceToken, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel, Newtonsoft.Json.JsonSerializerSettings serializerSettings);
[<System.Obsolete("Please use the constructor that takes JsonSerializerSettings as the third parameter.")>]
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * string * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> * Newtonsoft.Json.JsonSerializerSettings -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKeyOrResourceToken As String, connectionPolicy As ConnectionPolicy, desiredConsistencyLevel As Nullable(Of ConsistencyLevel), serializerSettings As JsonSerializerSettings)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKeyOrResourceToken
String

The authorization key or resource token to use to create the client.

connectionPolicy
ConnectionPolicy

The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

The default consistency policy for client operations.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings

The custom JsonSerializer settings to be used for serialization/derialization.

Attributes

Remarks

The service endpoint can be obtained from the Azure Management Portal. If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal If however you are connecting as a specific Azure Cosmos DB User, the value passed to authKeyOrResourceToken is the ResourceToken obtained from the permission feed for the user.

Using Direct connectivity, wherever possible, is recommended.

See also

Applies to

DocumentClient(Uri, String, JsonSerializerSettings, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token), a connection policy and a custom JsonSerializerSettings for the Azure Cosmos DB service.

public DocumentClient (Uri serviceEndpoint, string authKeyOrResourceToken, Newtonsoft.Json.JsonSerializerSettings serializerSettings, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * string * Newtonsoft.Json.JsonSerializerSettings * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKeyOrResourceToken As String, serializerSettings As JsonSerializerSettings, Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKeyOrResourceToken
String

The authorization key or resource token to use to create the client.

serializerSettings
Newtonsoft.Json.JsonSerializerSettings

The custom JsonSerializer settings to be used for serialization/derialization.

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) The default consistency policy for client operations.

Remarks

The service endpoint can be obtained from the Azure Management Portal. If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal If however you are connecting as a specific Azure Cosmos DB User, the value passed to authKeyOrResourceToken is the ResourceToken obtained from the permission feed for the user.

Using Direct connectivity, wherever possible, is recommended.

See also

Applies to

DocumentClient(Uri, String, HttpMessageHandler, ConnectionPolicy, Nullable<ConsistencyLevel>)

Initializes a new instance of the DocumentClient class using the specified service endpoint, an authorization key (or resource token) and a connection policy for the Azure Cosmos DB service.

public DocumentClient (Uri serviceEndpoint, string authKeyOrResourceToken, System.Net.Http.HttpMessageHandler handler, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy = default, Microsoft.Azure.Documents.ConsistencyLevel? desiredConsistencyLevel = default);
new Microsoft.Azure.Documents.Client.DocumentClient : Uri * string * System.Net.Http.HttpMessageHandler * Microsoft.Azure.Documents.Client.ConnectionPolicy * Nullable<Microsoft.Azure.Documents.ConsistencyLevel> -> Microsoft.Azure.Documents.Client.DocumentClient
Public Sub New (serviceEndpoint As Uri, authKeyOrResourceToken As String, handler As HttpMessageHandler, Optional connectionPolicy As ConnectionPolicy = Nothing, Optional desiredConsistencyLevel As Nullable(Of ConsistencyLevel) = Nothing)

Parameters

serviceEndpoint
Uri

The service endpoint to use to create the client.

authKeyOrResourceToken
String

The authorization key or resource token to use to create the client.

handler
HttpMessageHandler

The HTTP handler stack to use for sending requests (e.g., HttpClientHandler).

connectionPolicy
ConnectionPolicy

(Optional) The connection policy for the client.

desiredConsistencyLevel
Nullable<ConsistencyLevel>

(Optional) The default consistency policy for client operations.

Remarks

The service endpoint can be obtained from the Azure Management Portal. If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal If however you are connecting as a specific Azure Cosmos DB User, the value passed to authKeyOrResourceToken is the ResourceToken obtained from the permission feed for the user.

Using Direct connectivity, wherever possible, is recommended.

See also

Applies to