title: Automapper using constructor with default parameters
body: <p>Wondering the best way to handle this:</p>
  
  <pre><code>public class SrcClass{
      public int? Value1 {get;set;}
      public int? Value2 {get;set;}
  }
  
  public class DestClass{
      public DestClass(int? value1 = 1){
          Value1 = value1
      }
  
      public int Value1 {get;set;}
      public int Value2 {get;set;
  }
  
  Mapper.createMap&lt;SrcClass,DestClass&gt;()
    .ConstructUsing( src =&gt; new DestClass(src.Value1));
  
  var destObject = Mapper.Map&lt;DestClass&gt;(new SrcClass());
  </code></pre>
  
  <p>Now the problem is that <code>destObject.Value1</code> is <code>null</code> instead of <code>1</code> since AutoMapper set the value back to the value of the src object after the constructor is run. The way I see it, I have two bad options:</p>
  
  <ol>
  <li>I can repeat the default value in the <code>createMap</code> method. But this will introduce bugs later if someone adds or changes a default value in the constructor for <code>SrcClass</code> and fails to add that into the mapper configuration</li>
  <li>I can add an ignore of <code>Value1</code> after the <code>ConstructUsing</code>, but this suffers from the same problem as option 1. If someone comes in and adds in a new value with a default parameter, but fails to add it to the mapper, it will be a source of a bug.</li>
  </ol>
  
  <p>What I'd really like to do is somehow tell Automapper to only map properties that weren't passed in during the constructor.  Not really sure that it's even possible for the framework to handle something like that.  Any other ideas? </p>