Domain driven design repository implementation in infrastructure layer

后端 未结 2 1630
有刺的猬
有刺的猬 2021-02-05 22:47

I got a question on dependencies of DDD layered architecture. If the Repository implementation is in the infrastructure layer, that means that infrastructure layer has a depende

2条回答
  •  一整个雨季
    2021-02-05 23:45

    Yes in your case. And I have the same question :)

    Here is my explanation:

    It seems that Infrastructure layer is a special one in eric evans' arichitecture diagram. It implements Interfaces, Application, Domain.

    enter image description here

    This one is kind of farfetched.....

    But on the other hander, you could split infrastructure into seperate adapter module since the infrastructure components are typically composed of adapters, translators and facades.

    For example,

    1)Domain may have a dependence on mailing if you inject a MailManager to a DomainService. 2)Persistence have a dependence on Domain (Repository case).

    But if you seperate mailing and persistence into two modules, they have no depedence on each other. I think this may alleviate the problem.

    After all, layering is a method to decouple components not a purpose.

    Last but not least, I expect more convincible answers :)

提交回复
热议问题