DataMapper.Map is designed so that the ignore list is applied to the properties in the source object which means that it iterates all properties in the source object. That just seems backwards to me. The goal is to place data into the target object so it seems that the ignore list should identify properties in the target that you don't want set. It seems like this gives the following advantages:
So instead of this line in DataMapper.Map:
foreach (var propertyName in GetPropertyNames(source.GetType()))
we would have:
foreach (var propertyName in GetPropertyNames(target.GetType()))So my question is: Why is this implemented to iterate over the properties in the source and, hence, require an ignore list based on the source? I think about it in the opposite way - what am I missing here?
The ignore list is a blunt instrument no matter how you look at it. If you want finer control over the mapping, then create a DataMap object to directly control the mapping.
Copyright (c) Marimer LLC