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: learn-pr/aspnetcore/use-databases-dotnet-aspire-app/exercise-use-databases-persist-data-from-aspire-app.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ title: Exercise - Use database services to persist data from a .NET Aspire proje
5
5
metadata:
6
6
title: Exercise - Use database services to persist data from a .NET Aspire project
7
7
description: "In this exercise, you see how to add PostgreSQL and MongoDB database integrations to an existing app built with .NET Aspire."
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/use-databases-dotnet-aspire-app/includes/exercise-use-databases-persist-data-from-aspire-app.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ Install the .NET Aspire workload using the .NET CLI:
53
53
You should see the details of the .NET Aspire workload.
54
54
55
55
```console
56
-
Installed Workload Id Manifest Version Installation Source
56
+
Installed Workload Id Manifest Version Installation Source
@@ -171,7 +171,7 @@ Then in the configuration file, you can add the connection string:
171
171
172
172
### Using configuration providers
173
173
174
-
.NET Aspire has a feature of integrations that allows them to support a `Microsoft.Extensions.Configuration`. The PostgreSQL integration supports this feature, and by default it looks for settings using the `Aspire:Npgsql` key. In projects using *appsettings.json*, an example configuration might look like this:
174
+
.NET Aspire has a feature of integrations that allows them to support a `Microsoft.Extensions.Configuration`. The PostgreSQL integration supports this feature, and by default it looks for settings using the `Aspire:Npgsql` key. In projects using _appsettings.json_, an example configuration might look like this:
175
175
176
176
```json
177
177
{
@@ -186,7 +186,7 @@ Then in the configuration file, you can add the connection string:
186
186
}
187
187
```
188
188
189
-
The previous configuration is setting the connection string, enabling health checks, tracing, and metrics for the PostgreSQL integration. You code then no longer needs to specify the connection string, just use `builder.AddNpgsqlDataSource();`.
189
+
The previous configuration is setting the connection string, enabling health checks, tracing, and metrics for the PostgreSQL integration. Your code then no longer needs to specify the connection string, just use `builder.AddNpgsqlDataSource();`.
190
190
191
191
If you're using the PostgreSQL Entity Framework Core integration, you can use the `Aspire:Npgsql:EntityFrameworkCore:PostgreSQL` key to configure the database context:
192
192
@@ -296,7 +296,7 @@ As before, if you use the same database name in app host and the consuming proje
296
296
297
297
### Using configuration providers
298
298
299
-
The SQL Server integration also supports `Microsoft.Extensions.Configuration`. By default, it looks for settings using the `Aspire:SqlServer:SqlClient` key. In projects using *appsettings.json*, an example configuration might look like this:
299
+
The SQL Server integration also supports `Microsoft.Extensions.Configuration`. By default, it looks for settings using the `Aspire:SqlServer:SqlClient` key. In projects using _appsettings.json_, an example configuration might look like this:
*`ConnectionString`: The connection string of the SQL Server database
327
-
*`HealthChecks`: A boolean value that indicates whether the database health check is enabled
328
-
*`Tracing`: A boolean value that indicates whether the OpenTelemetry tracing is enabled
329
-
*`Metrics`: A boolean value that indicates whether the OpenTelemetry metrics are enabled
326
+
-`ConnectionString`: The connection string of the SQL Server database.
327
+
-`HealthChecks`: A boolean value that indicates whether the database health check is enabled.
328
+
-`Tracing`: A boolean value that indicates whether the OpenTelemetry tracing is enabled.
329
+
-`Metrics`: A boolean value that indicates whether the OpenTelemetry metrics are enabled.
330
330
331
331
### Connect to multiple databases
332
332
@@ -380,7 +380,7 @@ var myService = builder.AddProject<Projects.MyService>()
380
380
```
381
381
382
382
Like the PostgreSQL integration, the MySQL integration also allows you to create a container for database management tools. The previous example adds **PhpMyAdmin** to the solution.
383
-
383
+
384
384
## Using a MySQL database
385
385
386
386
The pattern is the same in the projects that need MySQL access. In the _Program.cs_ file, this code registers the database:
The `Aspire:MySqlConnector` key is used to configure the MySQL integration.
432
-
432
+
433
433
```json
434
434
{
435
435
"Aspire": {
@@ -508,6 +508,6 @@ if (app.Environment.IsDevelopment())
508
508
}
509
509
```
510
510
511
-
The above code checks the state of the app environment. If it's in development, the code retrieves the `CatalogContext` class and runs the `EnsureCreated` method. This method creates the database and runs any migrations that are pending.
511
+
The code checks the state of the app environment. If it's in development, the code retrieves the `CatalogContext` class and runs the `EnsureCreated` method. This method creates the database and runs any migrations that are pending.
512
512
513
513
For more information on how to seed the different database integrations, see the [.NET Aspire documentation](/dotnet/aspire/database/seed-database-data).
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/use-databases-dotnet-aspire-app/includes/test-aspire-projects.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
Testing is an essential part of developing high-quality software. Testing can help you find and fix bugs, improve performance, and ensure that your code meets the requirements and expectations of your users. Testing can also help you automate the deployment process and prevent regressions in the future. .NET Aspire provides tools and libraries to simplify the development, testing, and deployment of distributed applications.
2
2
3
-
In this unit, you learn how to test .NET Aspire projects using xUnit, a popular testing framework for .NET. You learn how to create different types of tests, such as integration tests and functional tests, and how to run them using the .NET Aspire CLI or Visual Studio.
3
+
In this unit, you learn how to test .NET Aspire projects using xUnit, a popular testing framework for .NET. You learn how to create different types of tests, such as integration tests and functional tests, and how to run them using the .NET Aspire CLI or Visual Studio.
4
4
5
-
## Create a test project
5
+
## Create a test project
6
6
7
7
The easiest way to create a .NET Aspire test project is to use the testing project template. You can use the `dotnet new` command to create a standard class library project, and then add the references to the .NET Aspire testing libraries and the xUnit packages.
8
8
9
9
```dotnetcli
10
10
dotnet new aspire-xunit
11
11
```
12
12
13
-
## Explore the test project
13
+
## Explore the test project
14
14
15
15
The following example test project was created as part of the **.NET Aspire Starter Application** template. If you're unfamiliar with it, see [Quickstart: Build your first .NET Aspire project](/dotnet/aspire/get-started/build-your-first-aspire-app). The .NET Aspire test project takes a project reference dependency on the target app host. Consider the template project:
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/use-databases-dotnet-aspire-app/index.yml
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
### YamlMime:Module
2
2
uid: learn.use-databases-dotnet-aspire-app
3
3
metadata:
4
-
title: Use databases in a .NET Aspire project
4
+
title: Use Databases in a .NET Aspire Project
5
5
description: "Learn about the database systems that .NET Aspire can connect to using built-in integrations. Then see how to configure connections to, and store data in, relational and nonrelational databases."
0 commit comments