Separating the Domain Model from the Data Model

by w0051977   Last Updated December 26, 2017 16:05 PM

I am trying to understand how to separate the domain model from the persistence mode so that the two can very independently as described here: http://blog.sapiensworks.com/post/2012/04/07/Just-Stop-It!-The-Domain-Model-Is-Not-The-Persistence-Model.aspx and here: http://enterprisecraftsmanship.com/2014/12/06/separation-of-concerns-in-orm/

I understand the benefit of mapping the ORM directly to the domain model i.e. speed of development. This would be my normal approach.

Say I wanted to separate the domain model from the data model. I have two questions:

1) My research tells me that the main limitation of doing this is change tracking. How is this a problem? I would map the domain model back to the data model to persist the changes - at that point NHibernate (my ORM) would find the changes.

2) Are there any examples of open source systems or examples that show how to separate the domain model from the data model?

I have read plenty of questions on here (and Stackoverflow) similar to mine e.g. this one: Achieving "Persistence Ignorance" by having a persistence model separate from the domain model. However, none answer my specific questions in my opinion.



Related Questions


Domain model design

Updated July 23, 2016 08:02 AM


What is a domain?

Updated October 23, 2017 18:05 PM