洋葱建筑 [英] Onion Architecture

查看:176
本文介绍了洋葱建筑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为即将到来的内部应用程序设计一个项目结构,试用由巴勒莫提出的洋葱建筑( http://jeffreypalermo.com/blog/the-onion-architecture-part-3/ )。



我跟着他的指导方针,但是到目前为止,我需要对项目的结构进行一些验证。



在图表之前,问题:



$ ol
  • 我认为参考文件都是正确的(按照箭头所指的''引用')来设置
    ,但是一些验证将会很好。


  • 我应该把我的依赖关系层这是哪里
    帮手去?这是否参考了所有其他项目?


  • 网络服务和UI,与DAL通信? (通过核心?如何?)


  • 应该去哪里? [广泛的问题我知道...]


  • 简化的概念图如下(文件夹表示命名空间):




    解决方案

    b $ b

    我认为参考文献都是正确的(按照箭头表示参考的图表设置),但是一些验证将会很好。


    1看起来不错,但我不确定将依赖关系插入图中是个好主意。


    我应该放在依赖关系解析图层中?这是帮助者去吗这参考了所有其他项目?


    2我认为依赖注入的东西会在这里。


    网络服务和UI,与DAL通信? (通过核心?如何?)


    3根据巴勒莫的图表,它是核心。在核心中,您将拥有与DAL和域模型以及处理存储库和域模型的服务(而不是Web服务)的存储库。而UI / Web服务将主要与服务进行交流。


    应该去哪里? [广泛的问题我知道...]


    4再次,我认为答案在巴勒莫的图表。但是在我看来,当完全了解架构时,组织项目可能会有所不同,而且微不足道。



    当我了解DDD和必要的设计模式后,洋葱建筑变得明显例如MVC,依赖注入,存储库/服务,ORM。


    I am setting up a project structure for an upcoming internal application trialling the Onion Architecture proposed by Palermo (http://jeffreypalermo.com/blog/the-onion-architecture-part-3/).

    I have followed his guidelines, however I need some verification on the structure of the project so far.

    Before the diagrams, the questions:

    1. I think the References are all correct (set up as per the diagram where an arrow means 'has a reference to') but some verification would be good.

    2. What should I put in my dependency resolution layer? Is this where Helpers go? This has a reference to all other projects?

    3. How do the web services & UI, communicate with the DAL? (Through the core? How?)

    4. What should go where? [Broad question I know...]

    The simplified conceptual diagram is as follows (Folders represent namespaces):

    解决方案

    I think the References are all correct (set up as per the diagram where an arrow means 'has a reference to') but some verification would be good.

    1 It looks OK but I am not sure it's a good idea to insert dependency resolution into the diagram.

    What should I put in my dependency resolution layer? Is this where Helpers go? This has a reference to all other projects?

    2 I believe dependency injection stuff would be here.

    How do the web services & UI, communicate with the DAL? (Through the core? How?)

    3 It is core according to Palermo's diagram. In core, you will have repositories talking to DAL and domain models, and services (not web services) dealing with repositories and domain models. And UI/web services will mainly talk to services.

    What should go where? [Broad question I know...]

    4 Again, I think the answer is in Palermo's diagram. But in my opinion, organizing projects can be different and trivial when there is full understanding of the architecture.

    Onion architecture became obvious to me once I understood DDD and necessary design patterns such as MVC, Dependency injection, Repository/Service, ORM.

    这篇关于洋葱建筑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆