finds.dev← search

// the find

ardalis/ddd-guestbook

★ 831 · C# · MIT · updated Oct 2019

A DDD guestbook example written for ASP.NET Core

A teaching example from Steve Smith (ardalis) showing Clean Architecture / DDD patterns in ASP.NET Core — aggregate roots, domain events, specs, and a generic EF repository. It's aimed at developers who are moving off N-tier and want a concrete reference for how to structure a .NET solution around the domain rather than the database. Not something you'd fork and ship.

The layer separation is clean and consistent: Core has zero infrastructure dependencies, Infrastructure wires up EF, and the Web project never touches the DbContext directly. Domain events are dispatched after persistence, which avoids the common mistake of firing them inside the aggregate before the save succeeds. The Specification pattern is shown working end-to-end — interface in Core, evaluated in the EF repository — which is a rare thing to see done correctly in a sample. Three distinct test project types (unit, integration, functional) show how to test each layer differently, including using TestHost for full-stack MVC tests without an actual HTTP server.

Abandoned in 2019 — it targets .NET Core 3.0, uses the old Startup.cs/Program.cs split, and Autofac wiring that predates the current DI idioms. The README is actually for the CleanArchitecture template, not the ddd-guestbook — the CI badges, goals, and dependency docs all describe a different repo, which makes it confusing as a learning resource. The generic EfRepository<T> interface is too thin to be useful once you have more than trivial queries, and the example doesn't show how to break out of it cleanly. Domain events are dispatched synchronously in the same request/transaction, which the code doesn't acknowledge as a deliberate tradeoff — anyone copying this into a real app may not notice until they need reliability guarantees.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →