Sam
Sam

Reputation: 15771

Is the Onion Architecture similar to the Service-Repository-UnitOfWork pattern?

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?

Upvotes: 1

Views: 654

Answers (1)

Sergei Rogovtcev
Sergei Rogovtcev

Reputation: 5832

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.

Upvotes: 3

Related Questions