I'm still trying to understand DDD. Let's say I have an immutable VO PresentationSlide
. Because it is immutable it can be easily shared and used by different entities.
But what happens if I try to map this to a database. In EntityFramework I could model the PresentationSlide
as a ComplexType
, meaning the properties of the shared PresentationSlide
are mapped to the tables using it. This is fine, but a Slide might be quite large and therefore I'm wasting space, if it used/reference several times.
As an alternative approach I could map a PresentationSlide
to a separate table and reference it. Because it is immutable this should also work. But now, if I modify a Presentation
, I have to copy the content of the old PresentationSlide
and create a new instance. If there are a lot of changes, I will soon have a lot of orphaned PresentationSlides
in my database.
Isn't this a problem? Is there a solution? Should I implement a custom periodical 'Cleanup orphaned PresentationSlides'-Task?