I have been writing MVC apps using what I call the Service-Repository-UnitOfWork pattern, which looks like this:

MVC Controllers --> Services --> Repositories --> EntityFramework

and then

Repositories/EntityFramework (constructs Domain Objects/POCO) --> Services --> Transform to ViewModels --> Controller --> Send the ViewModel/View to the client.

I use a IoC Container to configure the Interfaces for the services, repositories and UnitOfWork, that are injected into the constructors of the various components.

My question is, does this resemble the Onion Architecture at all?

Does that make any sense?

有帮助吗?

解决方案

No, it's not. Those are patterns from different categories.

Onion architecture governs entire solution, it is the same level as "multilayer" or "SOA" or "client-server".

"Service layer", "Repository", "UoW" represent implementation patterns, they govern specific parts inside you application.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top