xml/Microsoft.Azure.Cosmos/CosmosClient.xml (1,142 lines of code) (raw):
<Type Name="CosmosClient" FullName="Microsoft.Azure.Cosmos.CosmosClient">
<TypeSignature Language="C#" Value="public class CosmosClient : IDisposable" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi CosmosClient extends System.Object implements class System.IDisposable" />
<TypeSignature Language="DocId" Value="T:Microsoft.Azure.Cosmos.CosmosClient" />
<TypeSignature Language="VB.NET" Value="Public Class CosmosClient
Implements IDisposable" />
<TypeSignature Language="F#" Value="type CosmosClient = class
 interface IDisposable" />
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.36.0.0</AssemblyVersion>
<AssemblyVersion>3.38.1.0</AssemblyVersion>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
<AssemblyVersion>3.45.0.0</AssemblyVersion>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.IDisposable</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<summary>
Provides a client-side logical representation of the Azure Cosmos DB account.
This client can be used to configure and execute requests in the Azure Cosmos DB database service.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<remarks>
The returned not-initialized reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls
</remarks>
<altmember cref="T:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder" />
<example>
This example create a <see cref="T:Microsoft.Azure.Cosmos.CosmosClient" />, <see cref="T:Microsoft.Azure.Cosmos.Database" />, and a <see cref="T:Microsoft.Azure.Cosmos.Container" />.
The CosmosClient is created with the connection string and configured to use "East US 2" region.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
CosmosClient cosmosClient = new CosmosClient(
"connection-string-from-portal",
new CosmosClientOptions()
{
ApplicationRegion = Regions.EastUS2,
});
Database db = await cosmosClient.CreateDatabaseAsync("database-id");
Container container = await db.CreateContainerAsync("container-id");
// Dispose cosmosClient at application exit
]]></code></example>
<example>
This example creates a <see cref="T:Microsoft.Azure.Cosmos.CosmosClient" />, <see cref="T:Microsoft.Azure.Cosmos.Database" />, and a <see cref="T:Microsoft.Azure.Cosmos.Container" />.
The CosmosClient is created with the AccountEndpoint, AccountKey or ResourceToken and configured to use "East US 2" region.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
CosmosClient cosmosClient = new CosmosClient(
"account-endpoint-from-portal",
"account-key-from-portal",
new CosmosClientOptions()
{
ApplicationRegion = Regions.EastUS2,
});
Database db = await cosmosClient.CreateDatabaseAsync("database-id");
Container container = await db.CreateContainerAsync("container-id");
// Dispose cosmosClient at application exit
]]></code></example>
<example>
This example creates a <see cref="T:Microsoft.Azure.Cosmos.CosmosClient" />, <see cref="T:Microsoft.Azure.Cosmos.Database" />, and a <see cref="T:Microsoft.Azure.Cosmos.Container" />.
The CosmosClient is created through builder pattern using <see cref="T:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder" />.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Cosmos.Fluent;
CosmosClient cosmosClient = new CosmosClientBuilder("connection-string-from-portal")
.WithApplicationRegion("East US 2")
.Build();
Database db = await cosmosClient.CreateDatabaseAsync("database-id")
Container container = await db.CreateContainerAsync("container-id");
// Dispose cosmosClient at application exit
]]></code></example>
<altmember cref="T:Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CosmosClient ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>
Create a new CosmosClient used for mock testing
</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CosmosClient (string connectionString, Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string connectionString, class Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,Microsoft.Azure.Cosmos.CosmosClientOptions)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (connectionString As String, Optional clientOptions As CosmosClientOptions = Nothing)" />
<MemberSignature Language="F#" Value="new Microsoft.Azure.Cosmos.CosmosClient : string * Microsoft.Azure.Cosmos.CosmosClientOptions -> Microsoft.Azure.Cosmos.CosmosClient" Usage="new Microsoft.Azure.Cosmos.CosmosClient (connectionString, clientOptions)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="connectionString" Type="System.String" />
<Parameter Name="clientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Parameters>
<Docs>
<param name="connectionString">The connection string to the cosmos account. ex: AccountEndpoint=https://XXXXX.documents.azure.com:443/;AccountKey=SuperSecretKey; </param>
<param name="clientOptions">(Optional) client options</param>
<summary>
Creates a new CosmosClient with the connection string.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<remarks>
Emulator: To ignore SSL Certificate please suffix connectionstring with "DisableServerCertificateValidation=True;".
When CosmosClientOptions.HttpClientFactory is used, SSL certificate needs to be handled appropriately.
NOTE: DO NOT use this flag in production (only for emulator)
</remarks>
<altmember cref="T:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder" />
<example>
The CosmosClient is created with the connection string and configured to use "East US 2" region.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
CosmosClient cosmosClient = new CosmosClient(
"account-endpoint-from-portal",
"account-key-from-portal",
new CosmosClientOptions()
{
ApplicationRegion = Regions.EastUS2,
});
// Dispose cosmosClient at application exit
]]></code></example>
<altmember cref="T:Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CosmosClient (string accountEndpoint, Azure.AzureKeyCredential authKeyOrResourceTokenCredential, Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string accountEndpoint, class Azure.AzureKeyCredential authKeyOrResourceTokenCredential, class Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,Azure.AzureKeyCredential,Microsoft.Azure.Cosmos.CosmosClientOptions)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (accountEndpoint As String, authKeyOrResourceTokenCredential As AzureKeyCredential, Optional clientOptions As CosmosClientOptions = Nothing)" />
<MemberSignature Language="F#" Value="new Microsoft.Azure.Cosmos.CosmosClient : string * Azure.AzureKeyCredential * Microsoft.Azure.Cosmos.CosmosClientOptions -> Microsoft.Azure.Cosmos.CosmosClient" Usage="new Microsoft.Azure.Cosmos.CosmosClient (accountEndpoint, authKeyOrResourceTokenCredential, clientOptions)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="authKeyOrResourceTokenCredential" Type="Azure.AzureKeyCredential" />
<Parameter Name="clientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use</param>
<param name="authKeyOrResourceTokenCredential">AzureKeyCredential with master-key or resource token..</param>
<param name="clientOptions">(Optional) client options</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and AzureKeyCredential.
AzureKeyCredential enables changing/updating master-key/ResourceToken while CosmosClient is still in use.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<remarks>
AzureKeyCredential enables changing/updating master-key/ResourceToken whle CosmosClient is still in use.
The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
</remarks>
<altmember cref="T:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder" />
<example>
The CosmosClient is created with the AccountEndpoint, AccountKey or ResourceToken and configured to use "East US 2" region.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
AzureKeyCredential keyCredential = new AzureKeyCredential("account-master-key/ResourceToken");
CosmosClient cosmosClient = new CosmosClient(
"account-endpoint-from-portal",
keyCredential,
new CosmosClientOptions()
{
ApplicationRegion = Regions.EastUS2,
});
....
// To udpate key/credentials
keyCredential.Update("updated master-key/ResourceToken");
// Dispose cosmosClient at application exit
]]></code></example>
<altmember cref="T:Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CosmosClient (string accountEndpoint, Azure.Core.TokenCredential tokenCredential, Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string accountEndpoint, class Azure.Core.TokenCredential tokenCredential, class Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,Azure.Core.TokenCredential,Microsoft.Azure.Cosmos.CosmosClientOptions)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (accountEndpoint As String, tokenCredential As TokenCredential, Optional clientOptions As CosmosClientOptions = Nothing)" />
<MemberSignature Language="F#" Value="new Microsoft.Azure.Cosmos.CosmosClient : string * Azure.Core.TokenCredential * Microsoft.Azure.Cosmos.CosmosClientOptions -> Microsoft.Azure.Cosmos.CosmosClient" Usage="new Microsoft.Azure.Cosmos.CosmosClient (accountEndpoint, tokenCredential, clientOptions)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="tokenCredential" Type="Azure.Core.TokenCredential" />
<Parameter Name="clientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use.</param>
<param name="tokenCredential">
<see cref="T:Azure.Core.TokenCredential" />The token to provide AAD token for authorization.</param>
<param name="clientOptions">(Optional) client options</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and TokenCredential.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<remarks>
The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CosmosClient (string accountEndpoint, string authKeyOrResourceToken, Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string accountEndpoint, string authKeyOrResourceToken, class Microsoft.Azure.Cosmos.CosmosClientOptions clientOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.#ctor(System.String,System.String,Microsoft.Azure.Cosmos.CosmosClientOptions)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (accountEndpoint As String, authKeyOrResourceToken As String, Optional clientOptions As CosmosClientOptions = Nothing)" />
<MemberSignature Language="F#" Value="new Microsoft.Azure.Cosmos.CosmosClient : string * string * Microsoft.Azure.Cosmos.CosmosClientOptions -> Microsoft.Azure.Cosmos.CosmosClient" Usage="new Microsoft.Azure.Cosmos.CosmosClient (accountEndpoint, authKeyOrResourceToken, clientOptions)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="authKeyOrResourceToken" Type="System.String" />
<Parameter Name="clientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use</param>
<param name="authKeyOrResourceToken">The cosmos account key or resource token to use to create the client.</param>
<param name="clientOptions">(Optional) client options</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and account key.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<remarks>
The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
</remarks>
<altmember cref="T:Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder" />
<example>
The CosmosClient is created with the AccountEndpoint, AccountKey or ResourceToken and configured to use "East US 2" region.
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
CosmosClient cosmosClient = new CosmosClient(
"account-endpoint-from-portal",
"account-key-from-portal",
new CosmosClientOptions()
{
ApplicationRegion = Regions.EastUS2,
});
// Dispose cosmosClient at application exit
]]></code></example>
<altmember cref="T:Microsoft.Azure.Cosmos.CosmosClientOptions" />
</Docs>
</Member>
<Member MemberName="ClientOptions">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.CosmosClientOptions ClientOptions { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class Microsoft.Azure.Cosmos.CosmosClientOptions ClientOptions" />
<MemberSignature Language="DocId" Value="P:Microsoft.Azure.Cosmos.CosmosClient.ClientOptions" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property ClientOptions As CosmosClientOptions" />
<MemberSignature Language="F#" Value="member this.ClientOptions : Microsoft.Azure.Cosmos.CosmosClientOptions" Usage="Microsoft.Azure.Cosmos.CosmosClient.ClientOptions" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.CosmosClientOptions</ReturnType>
</ReturnValue>
<Docs>
<summary>
The <see cref="T:Microsoft.Azure.Cosmos.CosmosClientOptions" /> used initialize CosmosClient.
</summary>
<value>To be added.</value>
<remarks>This property is read-only. Modifying any options after the client has been created has no effect on the existing client instance.</remarks>
</Docs>
</Member>
<Member MemberName="CreateAndInitializeAsync">
<MemberSignature Language="C#" Value="public static System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync (string connectionString, System.Collections.Generic.IReadOnlyList<(string databaseId, string containerId)> containers, Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync(string connectionString, class System.Collections.Generic.IReadOnlyList`1<valuetype System.ValueTuple`2<string, string>> containers, class Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function CreateAndInitializeAsync (connectionString As String, containers As IReadOnlyList(Of ValueTuple(Of String, String)), Optional cosmosClientOptions As CosmosClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CosmosClient)" />
<MemberSignature Language="F#" Value="static member CreateAndInitializeAsync : string * System.Collections.Generic.IReadOnlyList<ValueTuple<string, string>> * Microsoft.Azure.Cosmos.CosmosClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient>" Usage="Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync (connectionString, containers, cosmosClientOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="connectionString" Type="System.String" />
<Parameter Name="containers" Type="System.Collections.Generic.IReadOnlyList<System.ValueTuple<System.String,System.String>>">
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="cosmosClientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="connectionString">The connection string to the cosmos account. ex: AccountEndpoint=https://XXXXX.documents.azure.com:443/;AccountKey=SuperSecretKey; </param>
<param name="containers">Containers to be initialized identified by it's database name and container name.</param>
<param name="cosmosClientOptions">(Optional) client options</param>
<param name="cancellationToken">(Optional) Cancellation Token</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and TokenCredential.
In addition to that it initializes the client with containers provided i.e The SDK warms up the caches and
connections before the first call to the service is made. Use this to obtain lower latency while startup of your application.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<returns>
A CosmosClient object.
</returns>
<remarks>
Emulator: To ignore SSL Certificate please suffix connectionstring with "DisableServerCertificateValidation=True;".
When CosmosClientOptions.HttpClientFactory is used, SSL certificate needs to be handled appropriately.
NOTE: DO NOT use this flag in production (only for emulator)
</remarks>
<example>
The CosmosClient is created with the ConnectionString and 2 containers in the account are initialized
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
List<(string, string)> containersToInitialize = new List<(string, string)>
{ ("DatabaseName1", "ContainerName1"), ("DatabaseName2", "ContainerName2") };
CosmosClient cosmosClient = await CosmosClient.CreateAndInitializeAsync("connection-string-from-portal",
containersToInitialize)
// Dispose cosmosClient at application exit
]]></code></example>
</Docs>
</Member>
<Member MemberName="CreateAndInitializeAsync">
<MemberSignature Language="C#" Value="public static System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync (string accountEndpoint, Azure.AzureKeyCredential authKeyOrResourceTokenCredential, System.Collections.Generic.IReadOnlyList<(string databaseId, string containerId)> containers, Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync(string accountEndpoint, class Azure.AzureKeyCredential authKeyOrResourceTokenCredential, class System.Collections.Generic.IReadOnlyList`1<valuetype System.ValueTuple`2<string, string>> containers, class Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,Azure.AzureKeyCredential,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function CreateAndInitializeAsync (accountEndpoint As String, authKeyOrResourceTokenCredential As AzureKeyCredential, containers As IReadOnlyList(Of ValueTuple(Of String, String)), Optional cosmosClientOptions As CosmosClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CosmosClient)" />
<MemberSignature Language="F#" Value="static member CreateAndInitializeAsync : string * Azure.AzureKeyCredential * System.Collections.Generic.IReadOnlyList<ValueTuple<string, string>> * Microsoft.Azure.Cosmos.CosmosClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient>" Usage="Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync (accountEndpoint, authKeyOrResourceTokenCredential, containers, cosmosClientOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="authKeyOrResourceTokenCredential" Type="Azure.AzureKeyCredential" />
<Parameter Name="containers" Type="System.Collections.Generic.IReadOnlyList<System.ValueTuple<System.String,System.String>>">
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="cosmosClientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use</param>
<param name="authKeyOrResourceTokenCredential">AzureKeyCredential with master-key or resource token.</param>
<param name="containers">Containers to be initialized identified by it's database name and container name.</param>
<param name="cosmosClientOptions">(Optional) client options</param>
<param name="cancellationToken">(Optional) Cancellation Token</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and AzureKeyCredential.
AzureKeyCredential enables changing/updating master-key/ResourceToken while CosmosClient is still in use.
In addition to that it initializes the client with containers provided i.e The SDK warms up the caches and
connections before the first call to the service is made. Use this to obtain lower latency while startup of your application.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<returns>
A CosmosClient object.
</returns>
<remarks>AzureKeyCredential enables changing/updating master-key/ResourceToken whle CosmosClient is still in use.</remarks>
<example>
The CosmosClient is created with the AccountEndpoint, AccountKey or ResourceToken and 2 containers in the account are initialized
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
List<(string, string)> containersToInitialize = new List<(string, string)>
{ ("DatabaseName1", "ContainerName1"), ("DatabaseName2", "ContainerName2") };
AzureKeyCredential keyCredential = new AzureKeyCredential("account-master-key/ResourceToken");
CosmosClient cosmosClient = await CosmosClient.CreateAndInitializeAsync("account-endpoint-from-portal",
keyCredential,
containersToInitialize)
....
// To udpate key/credentials
keyCredential.Update("updated master-key/ResourceToken");
// Dispose cosmosClient at application exit
]]></code></example>
</Docs>
</Member>
<Member MemberName="CreateAndInitializeAsync">
<MemberSignature Language="C#" Value="public static System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync (string accountEndpoint, Azure.Core.TokenCredential tokenCredential, System.Collections.Generic.IReadOnlyList<(string databaseId, string containerId)> containers, Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync(string accountEndpoint, class Azure.Core.TokenCredential tokenCredential, class System.Collections.Generic.IReadOnlyList`1<valuetype System.ValueTuple`2<string, string>> containers, class Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,Azure.Core.TokenCredential,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function CreateAndInitializeAsync (accountEndpoint As String, tokenCredential As TokenCredential, containers As IReadOnlyList(Of ValueTuple(Of String, String)), Optional cosmosClientOptions As CosmosClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CosmosClient)" />
<MemberSignature Language="F#" Value="static member CreateAndInitializeAsync : string * Azure.Core.TokenCredential * System.Collections.Generic.IReadOnlyList<ValueTuple<string, string>> * Microsoft.Azure.Cosmos.CosmosClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient>" Usage="Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync (accountEndpoint, tokenCredential, containers, cosmosClientOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="tokenCredential" Type="Azure.Core.TokenCredential" />
<Parameter Name="containers" Type="System.Collections.Generic.IReadOnlyList<System.ValueTuple<System.String,System.String>>">
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="cosmosClientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use.</param>
<param name="tokenCredential">
<see cref="T:Azure.Core.TokenCredential" />The token to provide AAD token for authorization.</param>
<param name="containers">Containers to be initialized identified by it's database name and container name.</param>
<param name="cosmosClientOptions">(Optional) client options</param>
<param name="cancellationToken">(Optional) Cancellation Token</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and TokenCredential.
In addition to that it initializes the client with containers provided i.e The SDK warms up the caches and
connections before the first call to the service is made. Use this to obtain lower latency while startup of your application.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<returns>
A CosmosClient object.
</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateAndInitializeAsync">
<MemberSignature Language="C#" Value="public static System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync (string accountEndpoint, string authKeyOrResourceToken, System.Collections.Generic.IReadOnlyList<(string databaseId, string containerId)> containers, Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.CosmosClient> CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, class System.Collections.Generic.IReadOnlyList`1<valuetype System.ValueTuple`2<string, string>> containers, class Microsoft.Azure.Cosmos.CosmosClientOptions cosmosClientOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync(System.String,System.String,System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.String,System.String}},Microsoft.Azure.Cosmos.CosmosClientOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function CreateAndInitializeAsync (accountEndpoint As String, authKeyOrResourceToken As String, containers As IReadOnlyList(Of ValueTuple(Of String, String)), Optional cosmosClientOptions As CosmosClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CosmosClient)" />
<MemberSignature Language="F#" Value="static member CreateAndInitializeAsync : string * string * System.Collections.Generic.IReadOnlyList<ValueTuple<string, string>> * Microsoft.Azure.Cosmos.CosmosClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient>" Usage="Microsoft.Azure.Cosmos.CosmosClient.CreateAndInitializeAsync (accountEndpoint, authKeyOrResourceToken, containers, cosmosClientOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.CosmosClient></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="accountEndpoint" Type="System.String" />
<Parameter Name="authKeyOrResourceToken" Type="System.String" />
<Parameter Name="containers" Type="System.Collections.Generic.IReadOnlyList<System.ValueTuple<System.String,System.String>>">
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.TupleElementNames(new System.String[] { "databaseId", "containerId" })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="cosmosClientOptions" Type="Microsoft.Azure.Cosmos.CosmosClientOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="accountEndpoint">The cosmos service endpoint to use</param>
<param name="authKeyOrResourceToken">The cosmos account key or resource token to use to create the client.</param>
<param name="containers">Containers to be initialized identified by it's database name and container name.</param>
<param name="cosmosClientOptions">(Optional) client options</param>
<param name="cancellationToken">(Optional) Cancellation Token</param>
<summary>
Creates a new CosmosClient with the account endpoint URI string and TokenCredential.
In addition to that it initializes the client with containers provided i.e The SDK warms up the caches and
connections before the first call to the service is made. Use this to obtain lower latency while startup of your application.
CosmosClient is thread-safe. Its recommended to maintain a single instance of CosmosClient per lifetime
of the application which enables efficient connection management and performance. Please refer to the
<see href="https://learn.microsoft.com/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3">performance guide</see>.
</summary>
<returns>
A CosmosClient object.
</returns>
<remarks>
The returned reference doesn't guarantee credentials or connectivity validations because initialization doesn't make any network calls.
</remarks>
<example>
The CosmosClient is created with the AccountEndpoint, AccountKey or ResourceToken and 2 containers in the account are initialized
<code language="c#"><![CDATA[
using Microsoft.Azure.Cosmos;
List<(string, string)> containersToInitialize = new List<(string, string)>
{ ("DatabaseName1", "ContainerName1"), ("DatabaseName2", "ContainerName2") };
CosmosClient cosmosClient = await CosmosClient.CreateAndInitializeAsync("account-endpoint-from-portal",
"account-key-from-portal",
containersToInitialize)
// Dispose cosmosClient at application exit
]]></code></example>
</Docs>
</Member>
<Member MemberName="CreateDatabaseAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseAsync (string id, Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseAsync(string id, class Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseAsync(System.String,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateDatabaseAsync (id As String, throughputProperties As ThroughputProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DatabaseResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateDatabaseAsync : string * Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>
override this.CreateDatabaseAsync : string * Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>" Usage="cosmosClient.CreateDatabaseAsync (id, throughputProperties, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="throughputProperties" Type="Microsoft.Azure.Cosmos.ThroughputProperties" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The database id.</param>
<param name="throughputProperties">(Optional) The throughput provisioned for a database in measurement of Request Units per second in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) A set of options that can be set.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Sends a request for creating a database.
A database manages users, permissions and a set of containers.
Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
with the database being the logical container for data.
Each Database consists of one or more containers, each of which in turn contain one or more
documents. Since databases are an administrative resource, the Service Master Key will be
required in order to access and successfully complete any action using the User APIs.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.DatabaseResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.DatabaseProperties" /> containing the resource record.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateDatabaseAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseAsync (string id, int? throughput = default, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseAsync(string id, valuetype System.Nullable`1<int32> throughput, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseAsync(System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateDatabaseAsync (id As String, Optional throughput As Nullable(Of Integer) = Nothing, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DatabaseResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateDatabaseAsync : string * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>
override this.CreateDatabaseAsync : string * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>" Usage="cosmosClient.CreateDatabaseAsync (id, throughput, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="throughput" Type="System.Nullable<System.Int32>" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The database id.</param>
<param name="throughput">(Optional) The throughput provisioned for a database in measurement of Request Units per second in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) A set of options that can be set.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Sends a request for creating a database.
A database manages users, permissions and a set of containers.
Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
with the database being the logical container for data.
Each Database consists of one or more containers, each of which in turn contain one or more
documents. Since databases are an administrative resource, the Service Master Key will be
required in order to access and successfully complete any action using the User APIs.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.DatabaseResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.DatabaseProperties" /> containing the resource record.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateDatabaseIfNotExistsAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseIfNotExistsAsync (string id, Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseIfNotExistsAsync(string id, class Microsoft.Azure.Cosmos.ThroughputProperties throughputProperties, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseIfNotExistsAsync(System.String,Microsoft.Azure.Cosmos.ThroughputProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateDatabaseIfNotExistsAsync (id As String, throughputProperties As ThroughputProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DatabaseResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateDatabaseIfNotExistsAsync : string * Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>
override this.CreateDatabaseIfNotExistsAsync : string * Microsoft.Azure.Cosmos.ThroughputProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>" Usage="cosmosClient.CreateDatabaseIfNotExistsAsync (id, throughputProperties, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="throughputProperties" Type="Microsoft.Azure.Cosmos.ThroughputProperties" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The database id.</param>
<param name="throughputProperties">The throughput provisioned for a database in measurement of Request Units per second in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) A set of additional options that can be set.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
<para>Check if a database exists, and if it doesn't, create it.
Only the database id is used to verify if there is an existing database. Other database properties
such as throughput are not validated and can be different then the passed properties.</para>
<para>A database manages users, permissions and a set of containers.
Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
with the database being the logical container for data.</para>
<para>Each Database consists of one or more containers, each of which in turn contain one or more
documents. Since databases are an administrative resource, the Service Master Key will be
required in order to access and successfully complete any action using the User APIs.</para>
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.DatabaseResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.DatabaseProperties" /> containing the resource record.
<list type="table"><listheader><term>StatusCode</term><description>Common success StatusCodes for the CreateDatabaseIfNotExistsAsync operation</description></listheader><item><term>201</term><description>Created - New database is created.</description></item><item><term>200</term><description>OK - This means the database already exists.</description></item></list></returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateDatabaseIfNotExistsAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseIfNotExistsAsync (string id, int? throughput = default, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.DatabaseResponse> CreateDatabaseIfNotExistsAsync(string id, valuetype System.Nullable`1<int32> throughput, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseIfNotExistsAsync(System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateDatabaseIfNotExistsAsync (id As String, Optional throughput As Nullable(Of Integer) = Nothing, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DatabaseResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateDatabaseIfNotExistsAsync : string * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>
override this.CreateDatabaseIfNotExistsAsync : string * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse>" Usage="cosmosClient.CreateDatabaseIfNotExistsAsync (id, throughput, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.DatabaseResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="throughput" Type="System.Nullable<System.Int32>" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The database id.</param>
<param name="throughput">(Optional) The throughput provisioned for a database in measurement of Request Units per second in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) A set of additional options that can be set.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
<para>Check if a database exists, and if it doesn't, create it.
Only the database id is used to verify if there is an existing database. Other database properties
such as throughput are not validated and can be different then the passed properties.</para>
<para>A database manages users, permissions and a set of containers.
Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
with the database being the logical container for data.</para>
<para>Each Database consists of one or more containers, each of which in turn contain one or more
documents. Since databases are an administrative resource, the Service Master Key will be
required in order to access and successfully complete any action using the User APIs.</para>
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.DatabaseResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.DatabaseProperties" /> containing the resource record.
<list type="table"><listheader><term>StatusCode</term><description>Common success StatusCodes for the CreateDatabaseIfNotExistsAsync operation</description></listheader><item><term>201</term><description>Created - New database is created.</description></item><item><term>200</term><description>OK- This means the database already exists.</description></item></list></returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateDatabaseStreamAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage> CreateDatabaseStreamAsync (Microsoft.Azure.Cosmos.DatabaseProperties databaseProperties, int? throughput = default, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.ResponseMessage> CreateDatabaseStreamAsync(class Microsoft.Azure.Cosmos.DatabaseProperties databaseProperties, valuetype System.Nullable`1<int32> throughput, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseStreamAsync(Microsoft.Azure.Cosmos.DatabaseProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateDatabaseStreamAsync (databaseProperties As DatabaseProperties, Optional throughput As Nullable(Of Integer) = Nothing, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResponseMessage)" />
<MemberSignature Language="F#" Value="abstract member CreateDatabaseStreamAsync : Microsoft.Azure.Cosmos.DatabaseProperties * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>
override this.CreateDatabaseStreamAsync : Microsoft.Azure.Cosmos.DatabaseProperties * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>" Usage="cosmosClient.CreateDatabaseStreamAsync (databaseProperties, throughput, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="databaseProperties" Type="Microsoft.Azure.Cosmos.DatabaseProperties" />
<Parameter Name="throughput" Type="System.Nullable<System.Int32>" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="databaseProperties">The database properties</param>
<param name="throughput">(Optional) The throughput provisioned for a database in measurement of Request Units per second in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) A set of options that can be set.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Send a request for creating a database.
A database manages users, permissions and a set of containers.
Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
with the database being the logical container for data.
Each Database consists of one or more containers, each of which in turn contain one or more
documents. Since databases are an administrative resource, the Service Master Key will be
required in order to access and successfully complete any action using the User APIs.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.DatabaseResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.DatabaseProperties" /> containing the resource record.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="public void Dispose ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.Dispose" />
<MemberSignature Language="VB.NET" Value="Public Sub Dispose ()" />
<MemberSignature Language="F#" Value="abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit" Usage="cosmosClient.Dispose " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.IDisposable.Dispose</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>
Dispose of cosmos client
</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="F#" Value="abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit" Usage="cosmosClient.Dispose disposing" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">True if disposing</param>
<summary>
Dispose of cosmos client
</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Endpoint">
<MemberSignature Language="C#" Value="public virtual Uri Endpoint { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Uri Endpoint" />
<MemberSignature Language="DocId" Value="P:Microsoft.Azure.Cosmos.CosmosClient.Endpoint" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property Endpoint As Uri" />
<MemberSignature Language="F#" Value="member this.Endpoint : Uri" Usage="Microsoft.Azure.Cosmos.CosmosClient.Endpoint" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Uri</ReturnType>
</ReturnValue>
<Docs>
<summary>
Gets the endpoint Uri for the Azure Cosmos DB service.
</summary>
<value>
The Uri for the account endpoint.
</value>
<remarks>To be added.</remarks>
<altmember cref="T:System.Uri" />
</Docs>
</Member>
<Member MemberName="GetContainer">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.Container GetContainer (string databaseId, string containerId);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.Container GetContainer(string databaseId, string containerId) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetContainer(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetContainer (databaseId As String, containerId As String) As Container" />
<MemberSignature Language="F#" Value="abstract member GetContainer : string * string -> Microsoft.Azure.Cosmos.Container
override this.GetContainer : string * string -> Microsoft.Azure.Cosmos.Container" Usage="cosmosClient.GetContainer (databaseId, containerId)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.Container</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="databaseId" Type="System.String" />
<Parameter Name="containerId" Type="System.String" />
</Parameters>
<Docs>
<param name="databaseId">Cosmos database name</param>
<param name="containerId">Cosmos container name</param>
<summary>
Returns a proxy reference to a container.
</summary>
<returns>Cosmos container proxy</returns>
<remarks>
<see cref="T:Microsoft.Azure.Cosmos.Container" /> proxy reference doesn't guarantee existence.
Please ensure container exists through <see cref="M:Microsoft.Azure.Cosmos.Database.CreateContainerAsync(Microsoft.Azure.Cosmos.ContainerProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
or <see cref="M:Microsoft.Azure.Cosmos.Database.CreateContainerIfNotExistsAsync(Microsoft.Azure.Cosmos.ContainerProperties,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />, before
operating on it.
</remarks>
</Docs>
</Member>
<Member MemberName="GetDatabase">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.Database GetDatabase (string id);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.Database GetDatabase(string id) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabase(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetDatabase (id As String) As Database" />
<MemberSignature Language="F#" Value="abstract member GetDatabase : string -> Microsoft.Azure.Cosmos.Database
override this.GetDatabase : string -> Microsoft.Azure.Cosmos.Database" Usage="cosmosClient.GetDatabase id" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.Database</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
</Parameters>
<Docs>
<param name="id">The Cosmos database id</param>
<summary>
Returns a proxy reference to a database.
</summary>
<returns>Cosmos database proxy</returns>
<remarks>
<see cref="T:Microsoft.Azure.Cosmos.Database" /> proxy reference doesn't guarantee existence.
Please ensure database exists through <see cref="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseAsync(System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
or <see cref="M:Microsoft.Azure.Cosmos.CosmosClient.CreateDatabaseIfNotExistsAsync(System.String,System.Nullable{System.Int32},Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />, before
operating on it.
</remarks>
<example>
<code language="c#"><![CDATA[
Database db = cosmosClient.GetDatabase("myDatabaseId");
DatabaseResponse response = await db.ReadAsync();
]]></code>
</example>
</Docs>
</Member>
<Member MemberName="GetDatabaseQueryIterator<T>">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.FeedIterator<T> GetDatabaseQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetDatabaseQueryIterator<T>(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabaseQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetDatabaseQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetDatabaseQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
override this.GetDatabaseQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="cosmosClient.GetDatabaseQueryIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for databases under an Cosmos DB Account using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" />.
</summary>
<returns>An iterator to go through the databases.</returns>
<remarks>
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started for syntax and examples.
<para><see cref="M:Microsoft.Azure.Cosmos.Database.ReadAsync(Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" /> is recommended for single database look-up.
</para></remarks>
<example>
This create the type feed iterator for database with queryText as input,
<code language="c#"><![CDATA[
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM c where c.status like @status")
.WithParameter("@status", "start%");
using (FeedIterator<DatabaseProperties> feedIterator = this.users.GetDatabaseQueryIterator<DatabaseProperties>(queryDefinition))
{
while (feedIterator.HasMoreResults)
{
FeedResponse<DatabaseProperties> response = await feedIterator.ReadNextAsync();
foreach (var database in response)
{
Console.WriteLine(database);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetDatabaseQueryIterator<T>">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.FeedIterator<T> GetDatabaseQueryIterator<T> (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetDatabaseQueryIterator<T>(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabaseQueryIterator``1(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetDatabaseQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetDatabaseQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
override this.GetDatabaseQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="cosmosClient.GetDatabaseQueryIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for databases under an Cosmos DB Account using a SQL statement. It returns a FeedIterator.
</summary>
<returns>An iterator to go through the databases.</returns>
<remarks>
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started for syntax and examples.
<para><see cref="M:Microsoft.Azure.Cosmos.Database.ReadAsync(Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" /> is recommended for single database look-up.
</para></remarks>
<example>
This create the type feed iterator for database with queryText as input,
<code language="c#"><![CDATA[
string queryText = "SELECT * FROM c where c.status like 'start%'";
using (FeedIterator<DatabaseProperties> feedIterator = this.users.GetDatabaseQueryIterator<DatabaseProperties>(queryText)
{
while (feedIterator.HasMoreResults)
{
FeedResponse<DatabaseProperties> response = await feedIterator.ReadNextAsync();
foreach (var database in response)
{
Console.WriteLine(database);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetDatabaseQueryStreamIterator">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.FeedIterator GetDatabaseQueryStreamIterator (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetDatabaseQueryStreamIterator(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabaseQueryStreamIterator(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetDatabaseQueryStreamIterator (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetDatabaseQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
override this.GetDatabaseQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="cosmosClient.GetDatabaseQueryStreamIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the query request.</param>
<summary>
This method creates a query for databases under an Cosmos DB Account using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" />.
</summary>
<returns>An iterator to go through the databases</returns>
<remarks>
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started for syntax and examples.
<para><see cref="M:Microsoft.Azure.Cosmos.Database.ReadStreamAsync(Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" /> is recommended for single database look-up.
</para></remarks>
<example>
Example on how to fully drain the query results.
<code language="c#"><![CDATA[
QueryDefinition queryDefinition = new QueryDefinition("select * From c where c._rid = @rid")
.WithParameter("@rid", "TheRidValue");
using (FeedIterator feedIterator = this.CosmosClient.GetDatabaseQueryStreamIterator(
queryDefinition)
{
while (feedIterator.HasMoreResults)
{
// Stream iterator returns a response with status for errors
using(ResponseMessage response = await feedIterator.ReadNextAsync())
{
// Handle failure scenario.
if(!response.IsSuccessStatusCode)
{
// Log the response.Diagnostics and handle the error
}
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetDatabaseQueryStreamIterator">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.FeedIterator GetDatabaseQueryStreamIterator (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetDatabaseQueryStreamIterator(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.GetDatabaseQueryStreamIterator(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetDatabaseQueryStreamIterator (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetDatabaseQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
override this.GetDatabaseQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="cosmosClient.GetDatabaseQueryStreamIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the query request.</param>
<summary>
This method creates a query for databases under an Cosmos DB Account using a SQL statement. It returns a FeedIterator.
</summary>
<returns>An iterator to go through the databases</returns>
<remarks>
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started for syntax and examples.
<para><see cref="M:Microsoft.Azure.Cosmos.Database.ReadStreamAsync(Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" /> is recommended for single database look-up.
</para></remarks>
<example>
Example on how to fully drain the query results.
<code language="c#"><![CDATA[
using (FeedIterator feedIterator = this.CosmosClient.GetDatabaseQueryStreamIterator(
("select * From c where c._rid = 'TheRidValue'")
{
while (feedIterator.HasMoreResults)
{
// Stream iterator returns a response with status for errors
using(ResponseMessage response = await feedIterator.ReadNextAsync())
{
// Handle failure scenario.
if(!response.IsSuccessStatusCode)
{
// Log the response.Diagnostics and handle the error
}
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="ReadAccountAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.AccountProperties> ReadAccountAsync ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.AccountProperties> ReadAccountAsync() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.CosmosClient.ReadAccountAsync" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ReadAccountAsync () As Task(Of AccountProperties)" />
<MemberSignature Language="F#" Value="abstract member ReadAccountAsync : unit -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.AccountProperties>
override this.ReadAccountAsync : unit -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.AccountProperties>" Usage="cosmosClient.ReadAccountAsync " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.AccountProperties></ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>
Reads the <see cref="T:Microsoft.Azure.Cosmos.AccountProperties" /> for the Azure Cosmos DB account.
</summary>
<returns>
A <see cref="T:Microsoft.Azure.Cosmos.AccountProperties" /> wrapped in a <see cref="T:System.Threading.Tasks.Task" /> object.
</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ResponseFactory">
<MemberSignature Language="C#" Value="public virtual Microsoft.Azure.Cosmos.CosmosResponseFactory ResponseFactory { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class Microsoft.Azure.Cosmos.CosmosResponseFactory ResponseFactory" />
<MemberSignature Language="DocId" Value="P:Microsoft.Azure.Cosmos.CosmosClient.ResponseFactory" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property ResponseFactory As CosmosResponseFactory" />
<MemberSignature Language="F#" Value="member this.ResponseFactory : Microsoft.Azure.Cosmos.CosmosResponseFactory" Usage="Microsoft.Azure.Cosmos.CosmosClient.ResponseFactory" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.47.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.CosmosResponseFactory</ReturnType>
</ReturnValue>
<Docs>
<summary>
The response factory used to create CosmosClient response types.
</summary>
<value>To be added.</value>
<remarks>
This can be used for generating responses for tests, and allows users to create
a custom container that modifies the response. For example the client encryption
uses this to decrypt responses before returning to the caller.
</remarks>
</Docs>
</Member>
</Members>
</Type>