title: LINQ to Entities Distinct clause giving a very strange error
body: <p>I have a, soon to be, range of <strong>DeviceId</strong> values in that column, in a database of about 40k rows. I thought the following query would quite easily give me a set of distinct <strong>DeviceId</strong> values, but it bombs with the error below it:</p>
  
  <pre><code>        ctx = New DataMonitorDbContext()
          devs = ctx.DataRecords.Select(Function(r) r.DeviceId).Distinct()
  </code></pre>
  
  <blockquote>
    <p>Unable to cast object of type
    'System.Data.Entity.Infrastructure.DbQuery<code>1[System.Int32]' to type
    'System.Collections.Generic.List</code>1[System.Int32]'.</p>
  </blockquote>
  
  <p>Although currently all my device ids are 1, a SQL DISTINCT query returns 1 in an instant. This is EF to SqlCE by the way. All does not seem kosher with that.</p>