DDD - DAL是否接入领域层 [英] DDD - Does DAL access Domain Layer

查看:190
本文介绍了DDD - DAL是否接入领域层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到一些样品参考从DAL领域层。我看到库接口的领域层中所定义,并且由于DAL实现它们,它们需要引用领域层。 DAL层也需要知道实体向上游返回这样的参考。我认为我们只引用下游,可有人解释一下吗?

I see some samples referencing the Domain Layer from DAL. I see that the repository interfaces are defined in the Domain Layer and since the DAL implements them, they need to reference the Domain Layer. The DAL also needs to know the Entities to return so the reference upstream. I thought that we only reference "downstream", can someone explain?

推荐答案

是的,这是确定。

想想看这样的:

如果你要改变(替换)任何一层,这将是哪一层?这是极不可能的,你会改变你的领域层,因为这会改变你的整个应用程序。如果你改变了DAL,那么你不应该需要修改域层。

If you are going to change (replace) any layer, what layer will it be? It's highly unlikely that you'd change your domain layer, since that would change your entire application. If you change the DAL, then you shouldn't need to modify the domain layer.

所以,这是您的域不依赖于任何一件好事。您可以DAL取决于您的域名,因为您的域名是您的应用程序的肉。

So, it's a good thing that your domain does not depend on anything. Your DAL can depend on your domain since your domain is the meat of your application.

我写这个文章,说明此项事宜的详细信息:

I have written an article about this which explains this in more detail:

http://www.kenneth-truyers.net/2013/05/12/the-n-layer-myth-and-basic-dependency-injection/

这篇关于DDD - DAL是否接入领域层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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