Skip to content

Adds parameters to app host usage examples, where applicable #1035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/database/includes/postgresql-explicit-username-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
When you want to explicitly provide the username and password, you can provide those as parameters. Consider the following alternative example:

```csharp
var username = builder.AddParameter("username", secret: true);
var password = builder.AddParameter("password", secret: true);

var postgres = builder.AddPostgres("postgres", username, password);

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

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

For more information, see [External parameters](../../fundamentals/external-parameters.md).
16 changes: 15 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: 05/14/2024
ms.date: 06/03/2024
---

# .NET Aspire MySQL database component
Expand Down Expand Up @@ -69,6 +69,20 @@ var myService = builder.AddProject<Projects.MyService>()
.WithReference(mysqldb);
```

When you want to explicitly provide a root MySQL password, you can provide it as a parameter. Consider the following alternative example:

```csharp
var password = builder.AddParameter("password", secret: true);

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

var myService = builder.AddProject<Projects.MyService>()
.WithReference(mysqldb);
```

For more information, see [External parameters](../fundamentals/external-parameters.md).

## Configuration

The .NET Aspire MySQL database component provides multiple configuration approaches and options to meet the requirements and conventions of your project.
Expand Down
16 changes: 15 additions & 1 deletion docs/database/oracle-entity-framework-component.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Oracle Entity Framework Component
description: Oracle Entity Framework Component
ms.date: 05/14/2024
ms.date: 06/03/2024
---

# .NET Aspire Oracle Entity Framework Component
Expand Down Expand Up @@ -86,6 +86,20 @@ var myService = builder.AddProject<Projects.MyService>()
.WithReference(oracledb);
```

When you want to explicitly provide a password, you can provide it as a parameter. Consider the following alternative example:

```csharp
var password = builder.AddParameter("password", secret: true);

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

var myService = builder.AddProject<Projects.MyService>()
.WithReference(oracledb);
```

For more information, see [External parameters](../fundamentals/external-parameters.md).

## Configuration

The .NET Aspire Oracle Entity Framework Core component provides multiple options to configure the database connection based on the requirements and conventions of your project.
Expand Down
4 changes: 3 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: 05/14/2024
ms.date: 06/03/2024
ms.topic: how-to
---

Expand Down Expand Up @@ -58,6 +58,8 @@ var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(postgresdb);
```

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

## Configuration

The .NET Aspire PostgreSQL component provides multiple configuration approaches and options to meet the requirements and conventions of your project.
Expand Down
4 changes: 3 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: 05/14/2024
ms.date: 06/03/2024
---

# .NET Aspire PostgreSQL Entity Framework Core component
Expand Down Expand Up @@ -72,6 +72,8 @@ var myService = builder.AddProject<Projects.MyService>()
.WithReference(postgresdb);
```

[!INCLUDE [postgresql-explicit-username-password](includes/postgresql-explicit-username-password.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
15 changes: 14 additions & 1 deletion docs/database/qdrant-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire Qdrant component
description: This article describes the .NET Aspire Qdrant component.
ms.topic: how-to
ms.date: 05/22/2024
ms.date: 06/03/2024
---

# .NET Aspire Qdrant component
Expand Down Expand Up @@ -75,6 +75,19 @@ var myService = builder.AddProject<Projects.MyService>()
.WithReference(qdrant);
```

When you want to explicitly provide the API key, you can provide it as a parameter. Consider the following alternative example:

```csharp
var apiKey = builder.AddParameter("apikey", secret: true);

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

var myService = builder.AddProject<Projects.MyService>()
.WithReference(qdrant);
```

For more information, see [External parameters](../fundamentals/external-parameters.md).

## Configuration

The .NET Aspire Qdrant Client component provides multiple options to configure the server connection based on the requirements and conventions of your project.
Expand Down
16 changes: 15 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: 05/14/2024
ms.date: 06/03/2024
---

# .NET Aspire SQL Server component
Expand Down Expand Up @@ -71,6 +71,20 @@ var myService = builder.AddProject<Projects.MyService>()
.WithReference(sqldb);
```

When you want to explicitly provide a root SQL password, you can provide it as a parameter. Consider the following alternative example:

```csharp
var password = builder.AddParameter("password", secret: true);

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

var myService = builder.AddProject<Projects.MyService>()
.WithReference(sqldb);
```

For more information, see [External parameters](../fundamentals/external-parameters.md).

## Configuration

The .NET Aspire SQL Server component provides multiple configuration approaches and options to meet the requirements and conventions of your project.
Expand Down
17 changes: 16 additions & 1 deletion docs/messaging/rabbitmq-client-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .NET Aspire RabbitMQ component
description: Learn how to use the .NET Aspire RabbitMQ client message-broker component.
ms.topic: how-to
ms.date: 05/14/2024
ms.date: 06/03/2024
---

# .NET Aspire RabbitMQ component
Expand Down Expand Up @@ -79,6 +79,21 @@ builder.AddProject<Projects.ExampleProject>()

The <xref:Aspire.Hosting.ResourceBuilderExtensions.WithReference%2A> method configures a connection in the `ExampleProject` project named `messaging`.

When you want to explicitly provide the username and password, you can provide those as parameters. Consider the following alternative example:

```csharp
var username = builder.AddParameter("username", secret: true);
var password = builder.AddParameter("password", secret: true);

var messaging = builder.AddRabbitMQ("messaging", username, password);

// Service consumption
builder.AddProject<Projects.ExampleProject>()
.WithReference(messaging);
```

For more information, see [External parameters](../fundamentals/external-parameters.md).

## Configuration

The .NET Aspire RabbitMQ component provides multiple options to configure the connection based on the requirements and conventions of your project.
Expand Down
Loading