Should the DAL be a translation layer between the relational model and the domain model?
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.
精彩评论