DAL 应该是关系模型和领域模型之间的转换层吗?

发布于 2024-08-23 16:35:49 字数 125 浏览 3 评论 0原文

我想我有一个简单的问题的答案,但我正在寻找一个共鸣板。 DAL 是否应该将来自数据库的任何内容(通过直接 SQL、存储过程、ORM 等)转换为业务层所理解的域实体? 另外,所有域实体都应该由接口定义吗(如果没有别的,为了最小化依赖性)?

Simple question for which I think I have an answer but I am looking for a sounding board. Should the DAL be the one translating whatever comes from the database (be it through straight SQL, stored procedures, ORM, whatever) into Domain Entities as understood by the business layer?
On a separate note, should all Domain Entities be defined by an Interface (if nothing else, to minimize dependencies) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

書生途 2024-08-30 16:35:49

DAL 应该是翻译者吗?
来自数据库的任何内容(是
它通过直接的SQL,存储
过程、ORM 等等)到域中
企业所理解的实体
层?

在我看来,是的。但我不确定是否有硬性规定。

另外一点,所有域都应该
实体由接口定义
(如果没有别的事,尽量减少
依赖项)?

我认为,不。这可能最终会产生许多没有任何价值的界面。亚格尼。

Should the DAL be the one translating
whatever comes from the database (be
it through straight SQL, stored
procedures, ORM, whatever) into Domain
Entities as understood by the business
layer?

In my opinion, yes. I'm not sure there is a hard and fast rule though.

On a separate note, should all Domain
Entities be defined by an Interface
(if nothing else, to minimize
dependencies) ?

In my opinion, no. That may end up in a lot of interfaces that add no value. YAGNI.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文