src/Clean.Architecture.AspireHost/README.md
This project uses .NET Aspire to orchestrate the application and its dependencies.
The Aspire host is configured to run a SQL Server container and automatically provides the connection string to the Web application.
Clean.Architecture.AspireHost as the startup projectWhen running through Aspire, the connection string is automatically provided by Aspire and will override the DefaultConnection in appsettings.json. The connection is named "cleanarchitecture" and is referenced in the Web project.
If you run the Web project directly (not through AspireHost), it will fall back to using the SQLite connection string from appsettings.json.
The existing migrations were created for SQLite but will work with SQL Server as well. If you need to create a new migration:
From the Web project directory:
dotnet ef migrations add MigrationName -c AppDbContext -p ../Clean.Architecture.Infrastructure/Clean.Architecture.Infrastructure.csproj -s Clean.Architecture.Web.csproj -o Data/Migrations
To update the database:
dotnet ef database update -c AppDbContext -p ../Clean.Architecture.Infrastructure/Clean.Architecture.Infrastructure.csproj -s Clean.Architecture.Web.csproj
Note: When running through Aspire, the database will be automatically created in the SQL Server container if it doesn't exist.
The SQL Server container is configured with ContainerLifetime.Persistent, which means the data will persist between application runs. To reset the database, you can:
docker rm <container-name>