title: Automapper Unable to cast object of type 'Parent' to type 'Child'
body: <p>I have two classes Base short class</p>
  
  <pre><code> public class ObjectShortEditView
   {
          public string FirstName { get; set; }
          public string LastName { get; set; }
   }
  </code></pre>
  
  <p>full view </p>
  
  <pre><code>public class ObjectEditView : ObjectShortEditView
   {
          public string Phone { get; set; }
  }
  </code></pre>
  
  <p>in automapper profile</p>
  
  <pre><code>Mapper.CreateMap&lt;Entity, ObjectShortEditView&gt;().IgnoreAllNonExisting();
  Mapper.CreateMap&lt;Entity, ObjectEditView &gt;().IgnoreAllNonExisting();
  </code></pre>
  
  <p>IgnoreAllNonExistingExtension</p>
  
  <pre><code>public static IMappingExpression&lt;TSource, TDestination&gt; IgnoreAllNonExisting&lt;TSource, TDestination&gt;
              (this IMappingExpression&lt;TSource, TDestination&gt; expression)
          {
              var flags = BindingFlags.Public | BindingFlags.Instance;
              var sourceType = typeof(TSource);
              var destinationProperties = typeof(TDestination).GetProperties(flags);
  
              foreach (var property in destinationProperties)
              {
                  if (sourceType.GetProperty(property.Name, flags) == null)
                  {
                      expression.ForMember(property.Name, opt =&gt; opt.Ignore());
                  }
              }
              return expression;
          }
  </code></pre>
  
  <p>Problem is when i try to map from entity to full edit view it fails</p>
  
  <pre><code>var view = Mapper.Map&lt;ObjectEditView&gt;(entityFromDb);
  </code></pre>
  
  <p>And some times it fails with exception</p>
  
  <pre><code>Unable to cast object of type 'ObjectShortEditView' to type 'ObjectEditView '.
  </code></pre>
  
  <p>Mean while i wrote this i got idea that it could be ignore all extension but why it even try to cast to short view when i ask map me to full view...</p>