DocumentClient.OpenAsync(CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Open the connection to validate that the client initialization is successful in the Azure Cosmos DB service.
public System.Threading.Tasks.Task OpenAsync (System.Threading.CancellationToken cancellationToken = default);
member this.OpenAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function OpenAsync (Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- cancellationToken
- CancellationToken
Returns
A Task object.
Examples
using (IDocumentClient client = new DocumentClient(new Uri("service endpoint"), "auth key"))
{
await client.OpenAsync();
}
Remarks
This method is recommended to be called, after the constructor, but before calling any other methods on the DocumentClient instance. If there are any initialization exceptions, this method will throw them (set on the task). Alternately, calling any API will throw initialization exception at the first call.