title: EF select performance - Task.FromResult vs ToListAsync
body: <p>I am trying to figure out what is the best way to select data via Entity Framework with async await. In the following code I have two options.</p>
  
  <p>The first uses Task.FromResult.<br>
  The second option tries to use the async await keywords to optimize the code.</p>
  
  <p>1.</p>
  
  <pre><code>public Task&lt;IEnumerable&lt;DesignExample&gt;&gt; ExecuteAsync(GetAllExamplesQuery query)
  {
      var designExamples = _copyDataDb.DesignExamples.OrderBy(dE =&gt; dE.Order).Select(DesignExample.MapFromEntity);
  
      return Task.FromResult(designExamples);
  }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>public async Task&lt;IEnumerable&lt;DesignExample&gt;&gt; ExecuteAsync(GetAllExamplesQuery query)
  {
      var designExamples = await _copyDataDb.DesignExamples.OrderBy(dE =&gt; dE.Order).ToListAsync();
  
      return designExamples.Select(DesignExample.MapFromEntity);
  }
  </code></pre>
  
  <ul>
  <li>Does the second option increase overall performance in relation to the first?</li>
  <li>The second option will await the call to the database, but will that really give me any benefits in this scenario?</li>
  </ul>