I'm trying to apply Clean Architecture to a simple ASP.NET MVC Core app by following Microsoft's ASP.NET architecture guidelines and their eShopOnWeb sample project.

In the standard Clean Architecture approach, business logic is put into "Use Case" classes in the core project. In the Microsoft's example, there are no Use Case classes, but it does have Services inside the Core project. Are the services inside the core supposed to be same as use cases? If no, what is their role?

  • 2
    Yes, in the given example Services within ApplicationCode, encapsulates business operations. Altogether (services, aggregates, entities, etc) looks like the application follows DDD. – Laiv Apr 18 '19 at 11:51
  • And, let me also just say this: "These are guidelines." Keep that in mind. We create "rules" only because we need "exceptions." Principles like these are intended to inform you about design practices that other designers (some of whom have written great volumes of production code) "found useful." But they are runes, not rules. – Mike Robinson Mar 26 at 20:45

In Microsoft's example, it uses "Services" as a group of Use Cases of the same Entity. Following the Clean Architecture approach, each use case should be a different class, implementing only one Execute method, which is the operation of the Use Case.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.