title: Automapper map from one object to nested objects
body: <p>What is the best way to map inner objects with Automapper 2.0</p>
  
  <ol>
  <li><p>Use the solution in this <a href="https://stackoverflow.com/questions/2634253/automapper-how-to-map-nested-object-from-an-objectid">question</a> (Automapper 1.0) </p></li>
  <li><p>Create a Custom Value Resolvers</p></li>
  <li><p>?</p>
  
  <pre><code>public class DTOObject
  {
      // MainObject
      public int Id { get; set; }
      public string Name { get; set; }
  
      // SubObject (TopObject)
      public string TopText { get; set; }
      public string TopFont { get; set; }
  
      // SubObject (BottomObject)
      public string BottomText { get; set; }
      public string BottomFont { get; set; }
  }
  
  public class MainObject
  {
      public int Id { get; set; }
      public string Name { get; set; }
  
      public SubObject TopObject { get; set; }
      public SubObject BottomObject { get; set; }
  }
  
  public class SubObject
  {
      public string SubPropText { get; set; }
      public string SubPropFont { get; set; }
  }
  </code></pre></li>
  </ol>
  
  <p>Custom Value Resolvers</p>
  
  <pre><code>    public class CustomResolver : ValueResolver&lt;DTOObject, SubObject&gt;
      {
          protected override SubObject ResolveCore(DTOObject source)
          {
              return Mapper.Map&lt;DTOObject, SubObject&gt;(source);
          }
      }
  </code></pre>