ConnectionMode ConnectionMode ConnectionMode Enum


Represents the connection mode to be used by the client when connecting to the Azure Cosmos DB service.

public enum ConnectionMode
type ConnectionMode = 
Public Enum ConnectionMode


Direct Direct Direct 1

Uses direct connectivity to connect to the data nodes in the Azure Cosmos DB service. Use gateway only to initialize and cache logical addresses and refresh on updates

Gateway Gateway Gateway 0

Use the Azure Cosmos DB gateway to route all requests to the Azure Cosmos DB service. The gateway proxies requests to the right data partition.


        DocumentClient client = new DocumentClient(endpointUri, masterKey, new ConnectionPolicy { ConnectionMode = ConnectionMode.Direct });


Direct and Gateway connectivity modes are supported. Gateway is the default.

Applies to

See Also