title: Automapper complex objects
body: <p>I've begun implementing this;<br>
  <a href="https://stackoverflow.com/questions/9498242/automapper-mapping-to-a-complex-object">Automapper, mapping to a complex object</a> but figured there must be a better way.</p>
  
  <p>So I created this;</p>
  
  <pre><code>Mapper.CreateMap&lt;StoreTransportWindow, CSVWindow&gt;()
      .ForMember(dest =&gt; dest.DC, opt =&gt; opt.ResolveUsing(fa =&gt; fa.DC.number))
      .ForMember(dest =&gt; dest.Type, opt =&gt; opt.ResolveUsing(fa =&gt; fa.Type))
  ;
  
  Mapper.CreateMap&lt;Store, CSVStore&gt;()
      .ForMember(dest =&gt; dest.StoreName, opt =&gt; opt.ResolveUsing(fa =&gt; fa.name))
      .ForMember(dest =&gt; dest.StoreNumber, opt =&gt; opt.ResolveUsing(fa =&gt; fa.number))
  ;
  </code></pre>
  
  <p>Now I'd like to use the above mappings in the primary map;</p>
  
  <pre><code>Mapper.CreateMap&lt;Store, CSVLineObject&gt;()
      .ForMember( dest =&gt; dest.store, opt =&gt; opt.ResolveUsing(/* This is where I'd like to use the above Store to  CSVStore mapping */)) 
  ;
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p><strong>edit</strong></p>
  
  <pre><code>public class CSVStore
  {
      public string StoreNumber { get; set; }
      public string StoreName { get; set; }
  }
  
  public class CSVWindow
  {
      public string Type { get; set; }
      public string DC { get; set; }
      public string TPC { get; set; }
  
  public class CSVLineObject
  {
      public CSVStore store { get; set; }
      public List&lt;CSVWindow&gt; storeWindows { get; set; }
  </code></pre>