I would say no, they should not, because DTOs are service or application specific, while the domain model is your “innermost” layer and should not have any dependencies. DTOs are part of the implementation of something other than a domain model, and therefore it violates the abstraction for your domain model to know about them.
Have you considered AutoMapper for this? You will end up writing a lot less code. In this case, I think you can just off:
Mapper.CreateMap<RegionOfInterest, RegionOfInterestData>(); Mapper.CreateMap<Camera, CameraData>();
And later:
CameraData cd = Mapper.Map<Camera, CameraData>(camera);
This not only reduces code failure, but also comparts the display code in its own “display layer”. You have one or more modules that register these mappings, which you can add, depending on which assembly really uses the DTO.
And of course, you can always create extension methods to simplify the actual display:
public static class CameraExtensions { public static CameraData ToCameraData(this Camera camera) { return Mapper.Map<Camera, CameraData>(camera); } }
It makes everything as simple as writing camera.ToCameraData() , but without , creating a tight relationship between the domain object ( Camera ) and DTO ( CameraData ). You basically have all the ease of use of the original version, but without communication.
If you create these dependencies because you are trying to create a CameraData object from private Camera data that is not publicly disclosed, then my immediate reaction will be, something not quite right in this design. Why not open read-only properties on the Camera object? If you still provide the outside world with access to them using the ToData method, then you obviously do not hide this information, you just make it more cumbersome to get.
What if you decide 3 months on the road that you need a different type of DTO? You do not need to change the object oriented to the Camera domain every time you want to support a new use case. It’s better, in my opinion, to add some read-only public properties to the class so that recipients can access the attributes they need.