Let's assume that I've two classes : CD and CDModel, and the mapping is defined as follows:
Mapper.CreateMap<CDModel, CD>()
.ForMember(c => c.Name, opt => opt.MapFrom(m => m.Title));
Is there an easy way to retrieve the original expression like c => c.Name (for source) and m => m.Title (for destination) from the mapping?
I tried this, but I miss some things...
var map = Mapper.FindTypeMapFor<CDModel, CD>();
foreach (var propertMap in map.GetPropertyMaps())
{
var source = ???;
var dest = propertMap.DestinationProperty.MemberInfo;
}
How to get the source and destination expressions?