1

我一直在写MVC应用使用的是我所谓的服务的存储库的UnitOfWork模式,它看起来像这样:洋葱体系结构是否与Service-Repository-UnitOfWork模式类似?

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

然后

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

我使用IoC容器为注入到各个组件的构造函数中的服务,存储库和UnitOfWork配置接口。

我的问题是,这完全类似于洋葱建筑吗?

这是否有意义?

+2

什么是洋葱建筑? – 2012-08-03 05:10:51

+1

也许你应该阅读Jeffrey Pallermo的关于他的Onion Architecture的文章,以确定它是否匹配:http://jeffreypalermo.com/blog/the-onion-architecture-part-1/。 – Steven 2012-08-03 08:34:58

回答

3

不,它不是。这些是来自不同类别的模式。

洋葱架构管理整个解决方案,与“多层”或“SOA”或“客户端服务器”相同。

“服务层”,“Repository”,“UoW”代表实现模式,它们管理您应用程序内部的特定部分。

相关问题