Skip to content

Commit

Permalink
Merge pull request #1047 from dotnet/main
Browse files Browse the repository at this point in the history
✅ Merge `main` into `live`
  • Loading branch information
github-actions[bot] authored Jun 6, 2024
2 parents 1c3fe06 + 7cccb53 commit 9582bac
Show file tree
Hide file tree
Showing 35 changed files with 256 additions and 115 deletions.
6 changes: 3 additions & 3 deletions docs/azureai/azureai-openai-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire Azure AI OpenAI component
description: Learn how to use the .NET Aspire Azure AI OpenAI component.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire Azure AI OpenAI component
Expand Down Expand Up @@ -74,12 +74,12 @@ dotnet add package Aspire.Hosting.Azure.CognitiveServices
In your app host project, register an Azure AI OpenAI resource using the following methods, such as <xref:Aspire.Hosting.AzureOpenAIExtensions.AddAzureOpenAI%2A>:

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var openai = builder.ExecutionContext.IsPublishMode
? builder.AddAzureOpenAI("openAiConnectionName")
: builder.AddConnectionString("openAiConnectionName");

// Service consumption
builder.AddProject<Projects.ExampleProject>()
.WithReference(openai);
```
Expand Down
4 changes: 3 additions & 1 deletion docs/azureai/azureai-search-document-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire Azure AI Search Documents component
description: Learn how to use the .NET Aspire Azure AI Search Documents component.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire Azure AI Search Documents component
Expand Down Expand Up @@ -95,6 +95,8 @@ dotnet add package Aspire.Hosting.Azure.CognitiveServices
In the _:::no-loc text="Program.cs":::_ file of `AppHost`, add an Azure Search service and consume the connection using the following methods:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var search = builder.ExecutionContext.IsPublishMode
? builder.AddAzureSearch("search")
: builder.AddConnectionString("search");
Expand Down
15 changes: 14 additions & 1 deletion docs/caching/caching-components.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Implement caching with .NET Aspire components
description: Learn how to connect to Redis and cache data using .NET Aspire components.
ms.date: 05/14/2024
ms.date: 06/05/2024
ms.topic: tutorial
---

Expand Down Expand Up @@ -45,10 +45,23 @@ Visual Studio creates a new .NET Aspire solution that consists of the following

1. Add the [.NET Aspire Hosting Redis](https://www.nuget.org/packages/Aspire.Hosting.Redis) package to the `AspireRedis.AppHost` project:

### [.NET CLI](#tab/dotnet-cli)

```dotnetcli
dotnet add package Aspire.Hosting.Redis
```

### [PackageReference](#tab/package-reference)

```xml
<PackageReference Include="Aspire.Hosting.Redis"
Version="[SelectVersion]" />
```

---

For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies).

2. Update the _:::no-loc text="Program.cs":::_ file of the `AspireRedis.AppHost` project to match the following code:

```csharp
Expand Down
6 changes: 3 additions & 3 deletions docs/caching/stackexchange-redis-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire StackExchange Redis component
description: This article describes the .NET Aspire StackExchange Redis component features and capabilities
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire StackExchange Redis component
Expand Down Expand Up @@ -52,10 +52,10 @@ public class ExampleService(IConnectionMultiplexer connectionMultiplexer)
[!INCLUDE [redis-app-host](includes/redis-app-host.md)]

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis");

// Service consumption
builder.AddProject<Projects.ExampleProject>()
.WithReference(redis)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire StackExchange Redis distributed caching component
description: This article describes the .NET Aspire StackExchange Redis distributed caching component features and capabilities
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire StackExchange Redis distributed caching component
Expand Down Expand Up @@ -52,10 +52,10 @@ public class ExampleService(IDistributedCache cache)
[!INCLUDE [redis-app-host](includes/redis-app-host.md)]

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis");

// Service consumption
builder.AddProject<Projects.ExampleProject>()
.WithReference(redis)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/caching/stackexchange-redis-output-caching-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire StackExchange Redis output caching Component
description: This article describes the .NET Aspire StackExchange Redis output caching component features and capabilities
ms.topic: how-to
ms.date: 04/29/2024
ms.date: 06/05/2024
---

# .NET Aspire StackExchange Redis output caching component
Expand Down Expand Up @@ -59,10 +59,10 @@ For apps with controllers, apply the `[OutputCache]` attribute to the action met
[!INCLUDE [redis-app-host](includes/redis-app-host.md)]

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis");

// Service consumption
var basket = builder.AddProject<Projects.ExampleProject>()
.WithReference(redis)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/database/azure-cosmos-db-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire Azure Cosmos DB component
description: This article describes the .NET Aspire Azure Cosmos DB component features and capabilities.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire Azure Cosmos DB component
Expand Down Expand Up @@ -71,11 +71,11 @@ dotnet add package Aspire.Hosting.Azure.CosmosDB
In your app host project, register the .NET Aspire Azure Cosmos DB component and consume the service using the following methods:

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var cosmos = builder.AddAzureCosmosDB("cosmos");
var cosmosdb = cosmos.AddDatabase("cosmosdb");

// Service consumption
var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(cosmosdb);
```
Expand Down
6 changes: 3 additions & 3 deletions docs/database/azure-cosmos-db-entity-framework-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire Microsoft Entity Framework Core Cosmos DB component
description: This article describes the .NET Aspire Microsoft Entity Framework Core Cosmos DB component features and capabilities.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire Microsoft Entity Framework Core Cosmos DB component
Expand Down Expand Up @@ -71,11 +71,11 @@ dotnet add package Aspire.Hosting.Azure.CosmosDB
In your app host project, register the .NET Aspire Microsoft Entity Framework Core Cosmos DB component and consume the service using the following methods:

```csharp
// Service registration
var builder = DistributedApplication.CreateBuilder(args);

var cosmos = builder.AddAzureCosmosDB("cosmos");
var cosmosdb = cosmos.AddDatabase("cosmosdb");

// Service consumption
var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(cosmosdb);
```
Expand Down
34 changes: 34 additions & 0 deletions docs/database/includes/postgresql-flexible-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### Azure app host usage

To deploy your PostgreSQL resources to Azure, you need to install the appropriate .NET Aspire hosting package:

### [.NET CLI](#tab/dotnet-cli)

```dotnetcli
dotnet add package Aspire.Hosting.Azure.PostgreSQL
```

### [PackageReference](#tab/package-reference)

```xml
<PackageReference Include="Aspire.Hosting.Azure.PostgreSQL"
Version="[SelectVersion]" />
```

---

After you've installed this package, you specify that your PostgreSQL resources will be hosted in Azure by calling the <xref:Aspire.Hosting.AzurePostgresExtensions.PublishAsAzurePostgresFlexibleServer%2A> extension method in your app host project:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
.PublishAsAzurePostgresFlexibleServer();

var postgresdb = postgres.AddDatabase("postgresdb");

var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(postgresdb);
```

The preceding call to `PublishAsAzurePostgresFlexibleServer` configures Postgres Server resource to be deployed as Azure Postgres Flexible Server. For more information, see [Azure Postgres Flexible Server](/azure/postgresql/flexible-server/overview).
4 changes: 3 additions & 1 deletion docs/database/mongodb-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire MongoDB database component
description: This article describes the .NET Aspire MongoDB database component.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire MongoDB database component
Expand Down Expand Up @@ -79,6 +79,8 @@ dotnet add package Aspire.Hosting.MongoDB
In your app host project, register the MongoDB database and consume the connection method and consume the service using the following methods:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var mongo = builder.AddMongoDB("mongo");
var mongodb = mongo.AddDatabase("mongodb");

Expand Down
4 changes: 3 additions & 1 deletion docs/database/mysql-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire MySQL database component
description: This article describes the .NET Aspire MySQL database component.
ms.topic: how-to
ms.date: 06/03/2024
ms.date: 06/05/2024
---

# .NET Aspire MySQL database component
Expand Down Expand Up @@ -62,6 +62,8 @@ After adding a `MySqlDataSource`, you can require the `MySqlDataSource` instance
[!INCLUDE [mysql-app-host](includes/mysql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var mysql = builder.AddMySql("mysql");
var mysqldb = mysql.AddDatabase("mysqldb");

Expand Down
4 changes: 3 additions & 1 deletion docs/database/mysql-entity-framework-component.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: MySQL Entity Framework Component
description: MySQL Entity Framework Component
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire Pomelo MySQL Entity Framework Component
Expand Down Expand Up @@ -61,6 +61,8 @@ builder.EnrichMySqlDbContext<MyDbContext>();
[!INCLUDE [mysql-app-host](includes/mysql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var mysql = builder.AddMySql("mysql");
var mysqldb = mysql.AddDatabase("mysqldb");

Expand Down
2 changes: 2 additions & 0 deletions docs/database/oracle-entity-framework-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ dotnet add package Aspire.Hosting.Oracle
In your app host project, register an Oracle container and consume the connection using the following methods:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var oracle = builder.AddOracle("oracle");
var oracledb = oracle.AddDatabase("oracledb");

Expand Down
6 changes: 5 additions & 1 deletion docs/database/postgresql-component.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: .NET Aspire PostgreSQL component
description: This article describes the .NET Aspire PostgreSQL component.
ms.date: 06/03/2024
ms.date: 06/05/2024
ms.topic: how-to
---

Expand Down Expand Up @@ -51,6 +51,8 @@ public class ExampleService(NpgsqlDataSource dataSource)
[!INCLUDE [postgresql-app-host](includes/postgresql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres");
var postgresdb = postgres.AddDatabase("postgresdb");

Expand All @@ -60,6 +62,8 @@ var exampleProject = builder.AddProject<Projects.ExampleProject>()

[!INCLUDE [postgresql-explicit-username-password](includes/postgresql-explicit-username-password.md)]

[!INCLUDE [postgresql-flexible-server](includes/postgresql-flexible-server.md)]

## Configuration

The .NET Aspire PostgreSQL component provides multiple configuration approaches and options to meet the requirements and conventions of your project.
Expand Down
6 changes: 5 additions & 1 deletion docs/database/postgresql-entity-framework-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire PostgreSQL Entity Framework Core component
description: This article describes the .NET Aspire PostgreSQL Entity Framework Core component.
ms.topic: how-to
ms.date: 06/03/2024
ms.date: 06/05/2024
---

# .NET Aspire PostgreSQL Entity Framework Core component
Expand Down Expand Up @@ -65,6 +65,8 @@ public class ExampleService(YourDbContext context)
[!INCLUDE [postgresql-app-host](includes/postgresql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres");
var postgresdb = postgres.AddDatabase("postgresdb");

Expand All @@ -74,6 +76,8 @@ var myService = builder.AddProject<Projects.MyService>()

[!INCLUDE [postgresql-explicit-username-password](includes/postgresql-explicit-username-password.md)]

[!INCLUDE [postgresql-flexible-server](includes/postgresql-flexible-server.md)]

## Configuration

The .NET Aspire PostgreSQL Entity Framework Core component provides multiple configuration approaches and options to meet the requirements and conventions of your project.
Expand Down
2 changes: 2 additions & 0 deletions docs/database/qdrant-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ dotnet add package Aspire.Hosting.Qdrant
In your app host project, register a Qdrant server and consume the connection using the following methods:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var qdrant = builder.AddQdrant("qdrant");

var myService = builder.AddProject<Projects.MyService>()
Expand Down
4 changes: 3 additions & 1 deletion docs/database/sql-server-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire SQL Server component
description: This article describes the .NET Aspire SQL Server component.
ms.topic: how-to
ms.date: 06/03/2024
ms.date: 06/05/2024
---

# .NET Aspire SQL Server component
Expand Down Expand Up @@ -64,6 +64,8 @@ After adding a `SqlConnection`, you can get the scoped [SqlConnection](/dotnet/a
[!INCLUDE [sql-app-host](includes/sql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var sql = builder.AddSqlServer("sql");
var sqldb = sql.AddDatabase("sqldb");

Expand Down
4 changes: 3 additions & 1 deletion docs/database/sql-server-entity-framework-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire SqlServer Entity Framework Core component
description: This article describes the .NET Aspire SQL Server Entity Framework Core component.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/05/2024
---

# .NET Aspire SqlServer Entity Framework Core component
Expand Down Expand Up @@ -61,6 +61,8 @@ public class ExampleService(YourDbContext client)
[!INCLUDE [sql-app-host](includes/sql-app-host.md)]

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var sql = builder.AddSqlServer("sql");
var sqldb = sql.AddDatabase("sqldb");

Expand Down
Loading

0 comments on commit 9582bac

Please sign in to comment.