title: Automapper and class hierarchy
body: <p>Given the following sources:</p>
  
  <pre><code>public class SourceBase { public string TheString { get; set; } }
  public class SourceDerived : SourceBase { }
  </code></pre>
  
  <p>and destinations:</p>
  
  <pre><code>public class DestBase { public string MyString { get; set; } }
  public class DestDerived : DestBase { }
  </code></pre>
  
  <p>And this mapping:</p>
  
  <pre><code>  CreateMap&lt;SourceBase, DestBase&gt;()
      .ForMember(dest =&gt; dest.MyString, o =&gt; o.MapFrom(x =&gt; x.TheString))
      .Include&lt;SourceDerived, DestDerived&gt;();
  
    CreateMap&lt;SourceDerived, DestDerived&gt;();
    Mapper.AssertConfigurationIsValid();  // Exception is thrown here
  </code></pre>
  
  <p>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).</p>
  
  <p>EDIT:</p>
  
  <p>The exact exception is <em>The following 1 properties on DestDerived could not be mapped:  MyString.  Add a custom mapping expression, ignore, or rename the property on DestDerived</em>.</p>