You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/Aspire.Hosting.Azure.CosmosDB/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ var myService = builder.AddProject<Projects.MyService>()
50
50
The `WithReference` method passes that connection information into a connection string named `cosmosdb` in the `MyService` project. In the _Program.cs_ file of `MyService`, the connection can be consumed using the client library [Aspire.Microsoft.Azure.Cosmos](https://www.nuget.org/packages/Aspire.Microsoft.Azure.Cosmos):
51
51
52
52
```csharp
53
-
builder.AddAzureCosmosDBClient("cosmosdb");
53
+
builder.AddAzureCosmosClient("cosmosdb");
54
54
```
55
55
56
56
### Emulator usage
@@ -66,7 +66,7 @@ When the AppHost starts up a local container running the Azure CosmosDB will als
In the _Program.cs_ file of your project, call the `AddAzureCosmosDbClient` extension method to register a `CosmosClient` for use via the dependency injection container. The method takes a connection name parameter.
22
+
In the _Program.cs_ file of your project, call the `AddAzureCosmosClient` extension method to register a `CosmosClient` for use via the dependency injection container. The method takes a connection name parameter.
You can then retrieve the `CosmosClient` instance using dependency injection. For example, to retrieve the client from a Web API controller:
@@ -44,10 +44,10 @@ The .NET Aspire Azure Cosmos DB library provides multiple options to configure t
44
44
45
45
### Use a connection string
46
46
47
-
When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling `builder.AddAzureCosmosDbClient()`:
47
+
When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling `builder.AddAzureCosmosClient()`:
And then the connection string will be retrieved from the `ConnectionStrings` configuration section. Two connection formats are supported:
@@ -99,13 +99,13 @@ The .NET Aspire Microsoft Azure Cosmos DB library supports [Microsoft.Extensions
99
99
You can also pass the `Action<MicrosoftAzureCosmosDBSettings> configureSettings` delegate to set up some or all the options inline, for example to disable tracing from code:
You can also setup the [CosmosClientOptions](https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions) using the optional `Action<CosmosClientOptions> configureClientOptions` parameter of the `AddAzureCosmosDbClient` method. For example, to set the `ApplicationName` "User-Agent" header suffix for all requests issues by this client:
105
+
You can also setup the [CosmosClientOptions](https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions) using the optional `Action<CosmosClientOptions> configureClientOptions` parameter of the `AddAzureCosmosClient` method. For example, to set the `ApplicationName` "User-Agent" header suffix for all requests issues by this client:
@@ -130,7 +130,7 @@ var myService = builder.AddProject<Projects.MyService>()
130
130
The `AddAzureCosmosDB` method will add an Azure Cosmos DB resource to the builder. Or `AddConnectionString` can be used to read connection information from the AppHost's configuration (for example, from "user secrets") under the `ConnectionStrings:cosmosdb` config key. The `WithReference` method passes that connection information into a connection string named `cosmosdb` in the `MyService` project. In the _Program.cs_ file of `MyService`, the connection can be consumed using:
131
131
132
132
```csharp
133
-
builder.AddAzureCosmosDBClient("cosmosdb");
133
+
builder.AddAzureCosmosClient("cosmosdb");
134
134
```
135
135
136
136
### Emulator usage
@@ -146,7 +146,7 @@ When the AppHost starts up a local container running the Azure CosmosDB will als
0 commit comments