ORM / How to deal with the correspondence between Domain object and Persistent object?

我只是一个虾纸丫 提交于 2019-12-01 20:21:12

I disagree with the linked article. While I agree that the concerns between the domain model and the persistence model are different, the entire purpose of an ORM is to map between a domain model and a persistence model. Since the ORM is supposed to provide that mapping, creating an additional class hierarchy to facilitate mapping is overkill and can lead to problems like the one you're describing. The fact that the domain model resembles the data model is indeed far more than a mere coincidence. Instead, they are both representing aspects of the same domain and should therefore have a high degree of correspondence. The ORM is designed to address the mismatch between an object model and a corresponding relational model. There are cases where mapping gets tough, but in NHibernate for example, these can be addressed by implementing custom user types for component mappings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!