Given the following sources:
public class SourceBase { public string TheString { get; set; } }
public class SourceDerived : SourceBase { }
and destinations:
public class DestBase { public string MyString { get; set; } }
public class DestDerived : DestBase { }
And this mapping:
CreateMap<SourceBase, DestBase>()
.ForMember(dest => dest.MyString, o => o.MapFrom(x => x.TheString))
.Include<SourceDerived, DestDerived>();
CreateMap<SourceDerived, DestDerived>();
Mapper.AssertConfigurationIsValid(); // Exception is thrown here
However, this gives a mapping error saying MyString isn't mapped on DestDerived. What gives? Do I really need to repeat the mappings for base class properties in all derived types (I do have more than one subclass in my actual code).
EDIT:
The exact exception is The following 1 properties on DestDerived could not be mapped: MyString. Add a custom mapping expression, ignore, or rename the property on DestDerived.