title: Map async result with automapper
body: <p>We are createing a Web.Api application of a angularjs application. The Web.Api returns a json result.</p>
  
  <p>Step one was getting the data:</p>
  
  <pre><code>    public List&lt;DataItem&gt;&gt; GetData()
      {
          return Mapper.Map&lt;List&lt;DataItem&gt;&gt;(dataRepository.GetData());
      }
  </code></pre>
  
  <p>That worked like a charm. Then we made the data repo async and we changed to code to work with it.</p>
  
  <pre><code>    public List&lt;DataItem&gt;&gt; GetData()
      {
          return Mapper.Map&lt;List&lt;DataItem&gt;&gt;(dataRepository.GetDataAsync().Result);
      }
  </code></pre>
  
  <p>Stil no problems. Now we wanted to make my Web.Api full async awayt so we changed it to:</p>
  
  <pre><code>    public async Task&lt;List&lt;DataItem&gt;&gt; GetData()
      {
          return await Mapper.Map&lt;Task&lt;List&lt;DataItem&gt;&gt;&gt;(dataRepository.GetDataAsync());
      }
  </code></pre>
  
  <p>At this moment Automapper gets confused. First we had the following mapper rule:
           Mapper.CreateMap();</p>
  
  <p>This worked until the web api method became full async. The exception said it was missing a map from </p>
  
  <pre><code> Task&lt;ICollection&lt;Data&gt;&gt; to Task&lt;ICollection&lt;DataItem&gt;&gt;.
  </code></pre>
  
  <p>The mapper was changed to</p>
  
  <pre><code>Mapper.CreateMap&lt;Task&lt;List&lt;Data&gt;&gt;, Task&lt;List&lt;DataItem&gt;&gt;&gt;();
  </code></pre>
  
  <p>When validating the configuration it complains that Result cannot be mapped. How should we configure the mappings? </p>