finds.dev← search

// the find

ardalis/CleanArchitecture.WorkerService

★ 828 · C# · MIT · updated Jul 2024

A solution template using Clean Architecture for building a .NET Core Worker Service.

A .NET Worker Service starter template organized around Clean Architecture layers: Core, Infrastructure, and the Worker itself. It's from Steve Smith (ardalis), whose Clean Architecture template for ASP.NET Core is widely referenced, so this is the background-service counterpart. The working example hits URLs, persists results to SQL Server, and wires up a simple in-memory queue — enough to see the pattern in action.

The layer separation is genuine, not cosmetic — Core has no infrastructure references, Infrastructure implements the Core interfaces, and the Worker just calls EntryPointService. The ILoggerAdapter wrapper is a small but useful pattern that makes logging testable without Microsoft.Extensions.Logging leaking into your core. There's a real test project with actual coverage of EntryPointService, not just placeholder files. Dependabot and CI are configured out of the box, so forks don't immediately rot.

The migrations are from 2019 and target .NET 7 even though the README says 7.0 — the template hasn't kept pace with .NET releases and you'll need to regen migrations before doing anything real. The in-memory queue is a stub that will be the first thing you rip out, and there's no guidance or example of wiring in an actual message broker (no Rabbit, no Azure Service Bus, not even a comment pointing to their docs). ServiceScopeFactoryLocator is effectively service locator anti-pattern sugar — it exists to work around DI lifetime issues in hosted services but the README doesn't explain when or why you'd use it, which will confuse anyone who hits that problem later. Last meaningful commit was mid-2024; .NET 10 is current and this template hasn't tracked any of the hosted service improvements since then.

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 →