Sample application for Modular Monolith Courses on Dometrain. Use 'ARDALIS' for 20% off individual courses!
View the interactive dependency diagram
Project Dependencies
2026 November Updated to .NET 11 (C# latest) and updated all dependencies to their latest versions. 2025 December Updated to .NET 10 and replaced MediatR with Mediator.SourceGen. 2025 July Removed FluentAssertions and replaced with Shoudly.
dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet ef migrations add Initial -c BookDbContext -p ../RiverBooks.Books/RiverBooks.Books.csproj -s RiverBooks.Web.csproj -o Data/Migrations
dotnet ef database update -c BookDbContext
-- You may need to specify projects
dotnet ef database update -c BookDbContext -p .\RiverBooks.Books.csproj --startup-project ..\RiverBooks.Web\RiverBooks.Web.csproj
-- for tests to work
dotnet ef database update -c BookDbContext -p .\RiverBooks.Books.csproj --startup-project ..\RiverBooks.Web\RiverBooks.Web.csproj -- --environment Testing
Watch out for <InvariantGlobalization>true</InvariantGlobalization> in your Web API project.
Once you have multiple modules you need so specify the context every time:
-- in RiverBooks.Users folder:
dotnet ef migrations add CartItemDescription -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations
dotnet ef database update -c UsersDbContext -p .\RiverBooks.Users.csproj -s ..\RiverBooks.Web\RiverBooks.Web.csproj
For Order Processing:
-- in RiverBooks.OrderProcessing folder:
dotnet ef migrations add Initial_OrderProcessing -c OrderProcessingDbContext -p ..\RiverBooks.OrderProcessing\RiverBooks.OrderProcessing.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations
dotnet ef database update -c OrderProcessingDbContext -p RiverBooks.OrderProcessing.csproj -s ..\RiverBooks.Web\RiverBooks.Web.csproj
Adding Addresses to Users:
-- in RiverBooks.Users folder:
dotnet ef migrations add UserAddresses -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations
dotnet ef database update -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj
Restore the repo-local .NET tools before running repository tooling:
dotnet tool restore
Run Slopwatch to detect newly introduced disabled tests, warning suppressions, empty catch blocks, and similar shortcut-style changes:
dotnet tool run slopwatch analyze -d . --fail-on warning
If Slopwatch reports that the baseline is missing, initialize it once and commit the generated file:
dotnet tool run slopwatch init
This repository now includes a Docker Compose-based devcontainer in .devcontainer/.
When opened in VS Code using Dev Containers: Reopen in Container, it starts:
- SQL Server (
sqlserver) - Redis (
redis) - MongoDB (
mongodb) - Papercut SMTP + web UI (
papercut)
The devcontainer service injects the expected app configuration via environment variables
(ConnectionStrings__*, MongoDB__ConnectionString, Redis__ConnectionString, and Email__*),
so running RiverBooks.Web from inside the container can connect to these dependencies directly.
On first container creation, .devcontainer/post-create.sh runs:
dotnet tool restore
cd src && dotnet restore RiverBooks.slnxPapercut web UI is available on port 37408.
The services don't publish ports on the host, so they won't clash with other local SQL Server/Redis/MongoDB
instances. VS Code forwards them (see forwardPorts in devcontainer.json); if a host port is already in use,
VS Code picks another one, so check the Ports panel for the actual local address.
docker run --name my-redis -p 6379:6379 -d redisdocker run --name mongodb -d -p 27017:27017 mongodocker run --name=papercut -p 25:25 -p 37408:37408 jijiechen/papercut:latest -d