title: EntityFramework - Load IDs to levels down without loading other columns
body: <p>I have 3 entities: Banners, Packs and Files.</p>
  
  <p>One Banner has many packs and one pack has many files.</p>
  
  <p>I need to get all the files ids for all banners. I tried the following:</p>
  
  <pre><code>  IList&lt;BannerModel&gt; banners = context.Banners
      .OrderBy(x =&gt; Guid.NewGuid())
      .Take(count)       
      .Select(x =&gt; 
        new BannerModel {
          Images = x.Packs.SelectMany(p =&gt; p.Files.Select(f =&gt; f.Id)).ToList()
        }).ToList();
  </code></pre>
  
  <p>However, I am getting an error on the Files id selecting:</p>
  
  <blockquote>
    <p>System.NotSupportedException: LINQ to Entities does not recognize the
    method 'System.Collections.Generic.List<code>1[System.Int32]
    ToList[Int32](System.Collections.Generic.IEnumerable</code>1[System.Int32])'
    method, and this method cannot be translated into a store expression. 
    at
    System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.DefaultTranslator.Translate(ExpressionConverter
    parent, MethodCallExpression call)    at ...</p>
  </blockquote>
  
  <p>Any idea of what might be wrong?</p>
  
  <p><strong>NOTE:</strong> I have Lazy Loading disabled.</p>