Skip to content

Commit

Permalink
Documentation: Adds additional remarks to CosmosClient (#3891)
Browse files Browse the repository at this point in the history
* CosmosClient documentation improvements

* Cref fix

* Link fix

* Documentation fix

* Typo fix

---------

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
  • Loading branch information
rinatmini and ealsur authored Jun 8, 2023
1 parent 6024f24 commit e08fd52
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Microsoft.Azure.Cosmos/src/CosmosClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ namespace Microsoft.Azure.Cosmos
/// ]]>
/// </code>
/// </example>
/// <remarks>
/// The returned not-initialized reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls
/// </remarks>
/// <seealso cref="CosmosClientOptions"/>
/// <seealso cref="Fluent.CosmosClientBuilder"/>
/// <seealso href="https://docs.microsoft.com/azure/cosmos-db/performance-tips">Performance Tips</seealso>
Expand Down Expand Up @@ -179,6 +182,9 @@ protected CosmosClient()
/// ]]>
/// </code>
/// </example>
/// <remarks>
/// The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
/// </remarks>
/// <seealso cref="CosmosClientOptions"/>
/// <seealso cref="Fluent.CosmosClientBuilder"/>
/// <seealso href="https://docs.microsoft.com/azure/cosmos-db/performance-tips">Performance Tips</seealso>
Expand Down Expand Up @@ -221,6 +227,9 @@ public CosmosClient(
/// ]]>
/// </code>
/// </example>
/// <remarks>
/// The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
/// </remarks>
/// <seealso cref="CosmosClientOptions"/>
/// <seealso cref="Fluent.CosmosClientBuilder"/>
/// <seealso href="https://docs.microsoft.com/azure/cosmos-db/performance-tips">Performance Tips</seealso>
Expand Down Expand Up @@ -274,7 +283,10 @@ public CosmosClient(
/// <seealso cref="Fluent.CosmosClientBuilder"/>
/// <seealso href="https://docs.microsoft.com/azure/cosmos-db/performance-tips">Performance Tips</seealso>
/// <seealso href="https://docs.microsoft.com/azure/cosmos-db/troubleshoot-dot-net-sdk">Diagnose and troubleshoot issues</seealso>
/// <remarks>AzureKeyCredential enables changing/updating master-key/ResourceToken whle CosmosClient is still in use.</remarks>
/// <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>
public CosmosClient(
string accountEndpoint,
AzureKeyCredential authKeyOrResourceTokenCredential,
Expand All @@ -292,6 +304,9 @@ public CosmosClient(
/// of the application which enables efficient connection management and performance. Please refer to the
/// <see href="https://docs.microsoft.com/azure/cosmos-db/performance-tips">performance guide</see>.
/// </summary>
/// <remarks>
/// The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
/// </remarks>
/// <param name="accountEndpoint">The cosmos service endpoint to use.</param>
/// <param name="tokenCredential"><see cref="TokenCredential"/>The token to provide AAD token for authorization.</param>
/// <param name="clientOptions">(Optional) client options</param>
Expand Down Expand Up @@ -368,6 +383,9 @@ internal CosmosClient(
/// ]]>
/// </code>
/// </example>
/// <remarks>
/// The returned reference doesn't guarantee credentials or connectivity validations because initialization doesn't make any network calls.
/// </remarks>
public static async Task<CosmosClient> CreateAndInitializeAsync(string accountEndpoint,
string authKeyOrResourceToken,
IReadOnlyList<(string databaseId, string containerId)> containers,
Expand Down
13 changes: 13 additions & 0 deletions Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ public CosmosClientBuilder(

/// <summary>
/// A method to create the cosmos client
/// 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>
/// Setting this property after sending any request won't have any effect.
/// The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
/// </remarks>
/// <returns>An instance of <see cref="CosmosClient"/>.</returns>
public CosmosClient Build()
Expand All @@ -191,6 +195,11 @@ public CosmosClient Build()

/// <summary>
/// A method to create the cosmos client and initialize the provided containers.
/// 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>
/// <param name="containers">Containers to be initialized identified by it's database name and container name.</param>
/// <param name="cancellationToken">(Optional) Cancellation Token</param>
Expand All @@ -214,9 +223,13 @@ public Task<CosmosClient> BuildAndInitializeAsync(IReadOnlyList<(string database

/// <summary>
/// A method to create the cosmos client
/// 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>
/// Setting this property after sending any request won't have any effect.
/// The returned reference doesn't guarantee credentials or connectivity validations because creation doesn't make any network calls.
/// </remarks>
internal virtual CosmosClient Build(DocumentClient documentClient)
{
Expand Down

0 comments on commit e08fd52

Please sign in to comment.