title: Automapper and Deep Loading
body: <p>I have a question with regards to automapping entity framework objects which have been "deep loaded". I have a Project object which has a member called Tasks which is a collection. And each task has a member called Works which is a collection. When the Project is deep loaded, those Tasks and their Works member are all populated. It looks like this:</p>
  
  <pre><code>-- Project
      -- Task 1
          -- Work 1
          -- Work 2
      -- Task 2
          -- Work 3
  </code></pre>
  
  <p>I have figured out how to map 1 level deep using a resolver like this:</p>
  
  <pre><code>CreateMap&lt;DataAccess.Task, Entities.Task&gt;()
              .ForMember(obj =&gt; obj.Description, obj =&gt; obj.MapFrom(src =&gt; src.Description))
              .ForMember(obj =&gt; obj.Estimate, obj =&gt; obj.MapFrom(src =&gt; src.Estimate))
              .ForMember(obj =&gt; obj.Id, obj =&gt; obj.MapFrom(src =&gt; src.ID))
              .ForMember(obj =&gt; obj.ProjectId, obj =&gt; obj.MapFrom(src =&gt; src.Project))
              .ForMember(obj =&gt; obj.TaskName, obj =&gt; obj.MapFrom(src =&gt; src.TaskName))
              .ForMember(obj =&gt; obj.Visible, obj =&gt; obj.MapFrom(src =&gt; src.Visible))
              .ForMember(obj =&gt; obj.WorkItems, obj =&gt; obj.ResolveUsing&lt;WorkItemsResolver&gt;().FromMember(src =&gt; src.Works));
  
  public class WorkItemsResolver : ValueResolver&lt;EntityCollection&lt;DataAccess.Work&gt;, ICollection&lt;Entities.Work&gt;&gt;
  {
      #region Overrides of ValueResolver&lt;List&lt;Task&gt;,List&lt;Task&gt;&gt;
  
      protected override ICollection&lt;Entities.Work&gt; ResolveCore(EntityCollection&lt;DataAccess.Work&gt; source)
      {
          Mapper.EntitiesMapper entitiesMapper = new EntitiesMapper(); 
          return source.Select(wk =&gt; entitiesMapper.Map&lt;Entities.Work&gt;(wk)).ToList();
      }
  
      #endregion
  }
  </code></pre>
  
  <p>However, I cannot figure out how to go 2 levels deep i.e. to be able to map a top level object (Project) and have it's child lists (and their child lists) also get mapped to their concommitant business objects. </p>
  
  <p>Does anyone know if this is possible with Automapper?</p>
  
  <p>Thanks</p>