The Onion Architecture(洋葱架构) part4

 In 2008, I coined a new pattern name called Onion Architecture.  You can read the previous parts here: part 1, part 2, part 3.  Over these four years, I’ve spoken about this pattern at user groups, conferences, and it’s even published in one of the chapters of ASP.NET MVC in Action from Manning.

在2008,我创造了一个叫做洋葱架构的新模式。您可以在这里阅读前面的部分:第1部分,第2部分,第3部分。在这四年中,我在用户组、会议上做过该模式的演讲,甚至将其作为章节发表在ASP.NET MVC in Action。

I’ve been overwhelmed by the traction this pattern name has enjoyed.  Folks from all over the country have written about and have talked about the pattern.  Some of the ones I’ve noticed are here (please comment with more – I welcome it).

 我已经被这个模式名称所吸引的牵引力所淹没了。全国各地的人们都写了很多关于这个模式的文章。我注意到的一些在这里(请多加评论-我欢迎它)。

  • Ayende Rahien’s opinion on Onion Architecture
  • “Cunning” Clinton’s view
  • Tony Sneed’s view and code sample
  • StackOverflow questions on Onion Architecture
  • Matt Hidinger’s Chicago .Net User Group video presentation on OA
  • One interesting StackOverflow question.

Back in 2008, I defined four tenets of Onion Architecture:

  • The application is built around an independent object model
  • Inner layers define interfaces.  Outer layers implement interfaces
  • Direction of coupling is toward the center
  • All application core code can be compiled and run separate from infrastructure

 追溯到2008,我定义了洋葱架构的四个原则:

  • 应用程序是围绕一个独立对象模型构建的。
  • 内层定义接口。外层实现接口
  • 耦合方向朝向中心。
  • 所有应用内核代码都可以编译并与基础设施分开运行。

Although there has been significant adoption of this pattern, I have received countless questions about how to implement it in various environments.  I mostly get asked about how it relates to domain-driven design.  First, onion architecture works well with and without DDD patterns.  It works well with CQRS, forms over data, and DDD.  It is merely an architectural pattern where the core object model is represented in a way that does not accept dependencies on less stable code.

尽管这种模式已经被广泛采用,我仍然收到无数关于如何在各种环境中实现它的问题。我经常被问到它是如何与领域驱动设计结合的。首先,洋葱架构在没有DDD模式的情况下工作得很好。它与CQRS,表格数据,和DDD结合的很好。它仅仅是一种架构模式,其中核心对象模型以不依赖于不稳定代码的方式表示。

CodeCampServer was an original sample of onion architecture, but it also grew as a sample of how to do ASP.NET MVC in various ways, how to use Portable Areas, and how to use MvcContrib features like input builders.  If you are just looking for onion architecture, it has too much going on.  I have pushed a much simpler solution that represents onion architecture concepts.  I have intentionally not included a UI input form or an IoC container, which most people associate with onion architecture.  Onion architecture works just fine without the likes of StructureMap or Castle Windsor.  Please check out the code here and let me know if this presents a simple approach – that is the goal.

CodeCampServer是洋葱架构的原始样本,但也成长为一个案例,此案例展示了如何以不同的方式做ASP.NET MVC,如何使用便携式领域,以及如何使用 MvcContrib 特征输入的建设者。如果你只是在寻找洋葱架构,它有太多的进展。我提出了一个更简单的,能代表洋葱架构概念的解决方案。我故意不包括UI输入表单或IOC容器,大多数人都将其与洋葱架构相关联。洋葱架构在没有类似StructureMap或Castle Windsor的情况下仍然运作良好。请检出这里的代码,并让我知道它是否提供了一个简单的方法-这是目标。

When there is enough interest, I will continue this series with more parts.  CQRS definitely deserves some addressing within this architecture, and so do object models that support task-based UIs.

当有足够的兴趣,我将继续这个系列更多的部分。CQRS在这种架构中绝对值得解决,支持基于任务UI的对象模型亦如此。

Get the code here at my BitBucket repository.

可从获取代码: here at my BitBucket repository.

你可能感兴趣的:(架构设计)