Menu

Clean Architecture in ASP.NET Core without the ceremony
📰

Clean Architecture in ASP.NET Core without the ceremony

DEV Community: dotnet·Mohammad Khalifeh·13 days ago
#mGVRqLb1
#devtodotnet#devto#dev#command#application
Long article (491 words) — no AI summary yet.
Reading 0:00
15s threshold

Clean Architecture has a reputation for ceremony: a dozen projects, an interface for every class, and three mapping layers between the database and the browser. It does not have to look like that. The useful part is one rule, and you can apply it in a small ASP.NET Core solution without the rest.

The one rule

Source code dependencies point inward. The domain knows nothing about the application layer, the application layer knows nothing about EF Core or HTTP, and the outer layers plug in through interfaces the inner layers define.

In practice I use four projects:

Domain : entities, value objects and the rules that must always hold. No NuGet packages beyond the base library.

Application : use cases. Each one is a command or a query with a handler and, where needed, a validator. This layer defines the ports it needs, such as IInquiryRepository or IEmailSender .

Infrastructure : EF Core, SMTP, file storage and HTTP clients.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.