开发者

Should the DAL be a translation layer between the relational model and the domain model?

开发者 https://www.devze.com 2022-12-21 13:55 出处:网络
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 pro

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) ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号