title: Mapping one source class to multiple derived classes with automapper
body: <p>Suppose i have a source class:</p>
  
  <pre><code>public class Source
  {
      //Several properties that can be mapped to DerivedBase and its subclasses
  }
  </code></pre>
  
  <p>And some destination classes:</p>
  
  <pre><code>public class DestinationBase
  {
       //Several properties
  }
  
  public class DestinationDerived1 : DestinationBase
  {
       //Several properties
  }
  
  public class DestinationDerived2 : DestinationBase
  {
       //Several properties
  }
  </code></pre>
  
  <p>Then I wish the derived destination classes to inherit the automapper configuration of the baseclass because I do not want to have to repeat it, is there any way to achieve this?</p>
  
  <pre><code>Mapper.CreateMap&lt;Source, DestinationBase&gt;()
      .ForMember(...)
      // Many more specific configurations that should not have to be repeated for the derived classes
      .ForMember(...);
  
  Mapper.CreateMap&lt;Source, DestinationDerived1 &gt;()
      .ForMember(...);
  Mapper.CreateMap&lt;Source, DestinationDerived2 &gt;()
      .ForMember(...);
  </code></pre>
  
  <p>When I write it like this it does not use the base mappings at all, and include doesn't seem to help me.</p>
  
  <p>Edit:
  This is what I get:</p>
  
  <pre><code>public class Source
  {
      public string Test { get; set; }
      public string Test2 { get; set; }
  }
  
  public class DestinationBase
  {
      public string Test3 { get; set; }
  }
  
  public class DestinationDerived1 : DestinationBase
  {
      public string Test4 { get; set; }
  }
  
  public class DestinationDerived2 : DestinationBase
  {
      public string Test5 { get; set; }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>Mapper.CreateMap&lt;Source, DestinationBase&gt;()
                .ForMember(d =&gt; d.Test3, e =&gt; e.MapFrom(s =&gt; s.Test))
                .Include&lt;Source, DestinationDerived1&gt;()
                .Include&lt;Source, DestinationDerived2&gt;();
  
          Mapper.CreateMap&lt;Source, DestinationDerived1&gt;()
                .ForMember(d =&gt; d.Test4, e =&gt; e.MapFrom(s =&gt; s.Test2));
  
          Mapper.CreateMap&lt;Source, DestinationDerived2&gt;()
                .ForMember(d =&gt; d.Test5, e =&gt; e.MapFrom(s =&gt; s.Test2));
  </code></pre>
  
  <p>AutoMapper.AutoMapperConfigurationException : 
  Unmapped members were found. Review the types and members below.</p>
  
  <h1>Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type</h1>
  
  <h2>Source -> DestinationDerived1 (Destination member list)</h2>
  
  <p>Test3</p>