关于[Should Controllers Reference Repositories or Services]的摘要:
A common question students ask when learning about Clean Architecture, SOLID, and/or Domain-Driven Design (DDD) is whether controllers (or razor pages or API Endpoints should work with repositories directly, or if they should only communicate with services. As with many questions in software, the answer is, "it depends", but I can offer some recommendations. A related question to this one, at more of an architectural level, is whether your Clean Architecture-using app needs a separate Application Layer, since often it's the Application Layer that would house the services we'll discuss here. We'll touch on that as well.
原文地址: https://ardalis.com/should-controllers-reference-repositories-services/