title: How to map empty strings as null with automapper?
body: <p>I need to map empty strings from source model as null to destination model.
  At first I used next profile for this:</p>
  
  <pre><code>public class MyProfile:Profile
  {
      public MyProfile()
      {
         CreateMap&lt;SrcModel, DestModel&gt;()
         .ForMember(dst =&gt; dst.Field1, opt =&gt; 
         {
            opt.Condition(src =&gt; !string.IsNullOrEmpty(src.src_Field1));
            opt.MapFrom(src =&gt; src.src_Field1)
         })
         //.......
         //same for other 15 fields
      }
  }
  </code></pre>
  
  <p>But duplicating same logic looks not very good and it's hard to modify it.</p>
  
  <p>Also I have tried to create special map for string like this:</p>
  
  <pre><code>CreateMap&lt;string, string&gt;().ConvertUsing(src =&gt; string.IsNullOrEmpty(src) ? 
  null : src)
  </code></pre>
  
  <p>But such string map has impact on all my maps, but I need such logic only for several maps, not for all.</p>
  
  <p>I also have tried to use ForAllMembers method:</p>
  
  <pre><code>... .ForAllMembers(opt =&gt; opt.Condition();
  </code></pre>
  
  <p>But there is no way do define type of source member, to cpecify some condition for strings.</p>
  
  <p>What is the best way to define some common mapping logic for several members of same type for one map?</p>