title: Can I do a subquery in in SELECT of LINQ to Entities to fill List in model?
body: <p>Is it possible to have a subquery in the <code>.Select</code> part of a <code>LINQ to Entities</code> query in order to fill a <code>List&lt;string&gt;</code> inside my view model? I found <a href="https://stackoverflow.com/questions/5485848/use-linq-to-entities-subquery-within-select-clause-to-fetch-a-field-value">Use Linq To Entities subquery within Select clause to fetch a field value</a> but when I try to do that I am getting the error:</p>
  
  <blockquote>
    <p>NotImplementedException: Microsoft.Data.Entity.Query.ResultOperators.Internal.QueryAnnotationResultOperator</p>
  </blockquote>
  
  <p>Is this possible to do with Entity Framework 7 and ASP.Net 5 MVC 6?</p>
  
  <pre><code>var model = _DbContext.ReleaseVersions
                          .OrderByDescending(rv =&gt; rv.DateReleased)
                          .Select(rv =&gt; new ReleaseNotesVM()
                          {
                              ID = rv.ID,
                              CurrentVersion = string.Concat(rv.Major, '.', rv.Minor, '.', rv.Patch),
                              ReleaseNotes = _DbContext.ReleaseNotes
                                                      .Where(rn =&gt; rn.ReleaseVersionID == rv.ID)
                                                      .Include(rn =&gt; rn.ReleaseVersion)
                                                      .Select(rn =&gt; rn.Note)
                                                      .ToList()
                          }).FirstOrDefault();
  </code></pre>
  
  <p>ViewModel being filled:</p>
  
  <pre><code>public class ReleaseNotesVM
  {
      public byte ID { get; set; }
      public string CurrentVersion { get; set; }
      public DateTime CurrentVersionReleaseDate { get; set; }
      public IEnumerable&lt;SelectListItem&gt; VersionList { get; set; }
      public byte SelectedVersionID { get; set; }
      public ICollection&lt;string&gt; ReleaseNotes { get; set; }
  }
  </code></pre>
  
  <p>DataModel:</p>
  
  <pre><code>public class ReleaseVersion
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public byte ID { get; set; }
  
      public DateTime DateReleased { get; set; }
      public byte Major { get; set; }
      public byte Minor { get; set; }
      public byte Patch { get; set; }
  
      public virtual ICollection&lt;ReleaseNote&gt; ReleaseNotes { get; set; }
  }
  public class ReleaseNote
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int ID { get; set; }
  
      public string Note { get; set; }
      public byte ReleaseVersionID { get; set; }
  
      [ForeignKey("ReleaseVersionID")]
      public ReleaseVersion ReleaseVersion { get; set; }
  }
  </code></pre>