Skip to content

Commit 69431f0

Browse files
committed
Code changes to refactor API names. Replaced delimeter to /
1 parent e96138f commit 69431f0

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

playground/CosmosEndToEnd/CosmosEndToEnd.ApiService/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
var builder = WebApplication.CreateBuilder(args);
99

1010
builder.AddServiceDefaults();
11-
builder.AddAzureCosmosDBClient("cosmos");
11+
builder.AddAzureCosmosClient("cosmos");
1212
builder.AddCosmosDbContext<TestCosmosContext>("cosmos", "ef");
1313

1414
var app = builder.Build();

playground/bicep/BicepSample.ApiService/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
builder.AddSqlServerDbContext<MyDbContext>("db");
1818
builder.AddNpgsqlDbContext<MyPgDbContext>("db2");
19-
builder.AddAzureCosmosDBClient("cosmos");
19+
builder.AddAzureCosmosClient("cosmos");
2020
builder.AddRedisClient("redis");
2121
builder.AddAzureBlobClient("blob");
2222
builder.AddAzureTableClient("table");

src/Aspire.Hosting.Azure.CosmosDB/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var myService = builder.AddProject<Projects.MyService>()
5050
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):
5151

5252
```csharp
53-
builder.AddAzureCosmosDBClient("cosmosdb");
53+
builder.AddAzureCosmosClient("cosmosdb");
5454
```
5555

5656
### Emulator usage
@@ -66,7 +66,7 @@ When the AppHost starts up a local container running the Azure CosmosDB will als
6666

6767
```csharp
6868
// Service code
69-
builder.AddAzureCosmosDbClient("cosmos");
69+
builder.AddAzureCosmosClient("cosmos");
7070
```
7171

7272
## Additional documentation

src/Components/Aspire.Microsoft.Azure.Cosmos/AspireMicrosoftAzureCosmosDBExtensions.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static class AspireMicrosoftAzureCosmosDBExtensions
2727
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
2828
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.</remarks>
2929
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
30-
public static void AddAzureCosmosDBClient(
30+
public static void AddAzureCosmosClient(
3131
this IHostApplicationBuilder builder,
3232
string connectionName,
3333
Action<MicrosoftAzureCosmosDBSettings>? configureSettings = null,
@@ -46,7 +46,7 @@ public static void AddAzureCosmosDBClient(
4646
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
4747
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.</remarks>
4848
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
49-
public static void AddKeyedAzureCosmosDbClient(
49+
public static void AddKeyedAzureCosmosClient(
5050
this IHostApplicationBuilder builder,
5151
string name,
5252
Action<MicrosoftAzureCosmosDBSettings>? configureSettings = null,
@@ -104,7 +104,7 @@ private static void AddAzureCosmosDB(
104104
var cosmosApplicationName = CosmosConstants.CosmosApplicationName;
105105
if (!string.IsNullOrEmpty(clientOptions.ApplicationName))
106106
{
107-
cosmosApplicationName = $"{cosmosApplicationName}|{clientOptions.ApplicationName}";
107+
cosmosApplicationName = $"{cosmosApplicationName}/{clientOptions.ApplicationName}";
108108
}
109109

110110
clientOptions.ApplicationName = cosmosApplicationName;

src/Components/Aspire.Microsoft.Azure.Cosmos/PublicAPI.Unshipped.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings.DisableTracing.get
1010
Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings.DisableTracing.set -> void
1111
Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings.MicrosoftAzureCosmosDBSettings() -> void
1212
Microsoft.Extensions.Hosting.AspireMicrosoftAzureCosmosDBExtensions
13-
static Microsoft.Extensions.Hosting.AspireMicrosoftAzureCosmosDBExtensions.AddAzureCosmosDBClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! connectionName, System.Action<Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings!>? configureSettings = null, System.Action<Microsoft.Azure.Cosmos.CosmosClientOptions!>? configureClientOptions = null) -> void
14-
static Microsoft.Extensions.Hosting.AspireMicrosoftAzureCosmosDBExtensions.AddKeyedAzureCosmosDbClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings!>? configureSettings = null, System.Action<Microsoft.Azure.Cosmos.CosmosClientOptions!>? configureClientOptions = null) -> void
13+
static Microsoft.Extensions.Hosting.AspireMicrosoftAzureCosmosDBExtensions.AddAzureCosmosClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! connectionName, System.Action<Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings!>? configureSettings = null, System.Action<Microsoft.Azure.Cosmos.CosmosClientOptions!>? configureClientOptions = null) -> void
14+
static Microsoft.Extensions.Hosting.AspireMicrosoftAzureCosmosDBExtensions.AddKeyedAzureCosmosClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Aspire.Microsoft.Azure.Cosmos.MicrosoftAzureCosmosDBSettings!>? configureSettings = null, System.Action<Microsoft.Azure.Cosmos.CosmosClientOptions!>? configureClientOptions = null) -> void

src/Components/Aspire.Microsoft.Azure.Cosmos/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dotnet add package Aspire.Microsoft.Azure.Cosmos
1919

2020
## Usage example
2121

22-
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.
2323

2424
```csharp
25-
builder.AddAzureCosmosDbClient("cosmosConnectionName");
25+
builder.AddAzureCosmosClient("cosmosConnectionName");
2626
```
2727

2828
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
4444

4545
### Use a connection string
4646

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()`:
4848

4949
```csharp
50-
builder.AddAzureCosmosDbClient("cosmosConnectionName");
50+
builder.AddAzureCosmosClient("cosmosConnectionName");
5151
```
5252

5353
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
9999
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:
100100

101101
```csharp
102-
builder.AddAzureCosmosDbClient("cosmosConnectionName", settings => settings.DisableTracing = true);
102+
builder.AddAzureCosmosClient("cosmosConnectionName", settings => settings.DisableTracing = true);
103103
```
104104

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 `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:
106106

107107
```csharp
108-
builder.AddAzureCosmosDbClient("cosmosConnectionName", configureClientOptions: clientOptions => clientOptions.ApplicationName = "myapp");
108+
builder.AddAzureCosmosClient("cosmosConnectionName", configureClientOptions: clientOptions => clientOptions.ApplicationName = "myapp");
109109
```
110110

111111
## AppHost extensions
@@ -130,7 +130,7 @@ var myService = builder.AddProject<Projects.MyService>()
130130
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:
131131

132132
```csharp
133-
builder.AddAzureCosmosDBClient("cosmosdb");
133+
builder.AddAzureCosmosClient("cosmosdb");
134134
```
135135

136136
### Emulator usage
@@ -146,7 +146,7 @@ When the AppHost starts up a local container running the Azure CosmosDB will als
146146

147147
```csharp
148148
// Service code
149-
builder.AddAzureCosmosDbClient("cosmos");
149+
builder.AddAzureCosmosClient("cosmos");
150150
```
151151

152152
## Additional documentation

tests/Aspire.Microsoft.Azure.Cosmos.Tests/ConformanceTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ protected override void RegisterComponent(HostApplicationBuilder builder, Action
2828
{
2929
if (key is null)
3030
{
31-
builder.AddAzureCosmosDBClient("cosmosdb", configure);
31+
builder.AddAzureCosmosClient("cosmosdb", configure);
3232
}
3333
else
3434
{
35-
builder.AddKeyedAzureCosmosDbClient(key, configure);
35+
builder.AddKeyedAzureCosmosClient(key, configure);
3636
}
3737
}
3838

tests/testproject/TestProject.IntegrationServiceA/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
if (!resourcesToSkip.HasFlag(TestResourceNames.cosmos))
6868
{
69-
builder.AddAzureCosmosDBClient("cosmos");
69+
builder.AddAzureCosmosClient("cosmos");
7070
}
7171

7272
// Ensure healthChecks are added. Some components like Cosmos

0 commit comments

Comments
 (0)