title: Returning a Dictionary from a gouped query
body: <p>I have a table in my SQL Anywhere 12.0.1 database:</p>
  
  <pre><code>CREATE TABLE Entries (
      ListId        UNIQUEIDENTIFIER NOT NULL,
      . . .
  );
  </code></pre>
  
  <p>I need to query the table to get the number of rows in the table that have the same ListID.  In SQL:</p>
  
  <pre><code>SELECT ListID, COUNT(*)
  FROM Entries
  GROUP BY ListId;
  </code></pre>
  
  <p>I want to execute this query using Entity Framework 4.x, and I want to return the results as a <code>Dictionary&lt;Guid, long&gt;</code>.  Something like this:</p>
  
  <pre><code>public Dictionary&lt;Guid, long&gt; GetRowCounts( MyEntities context ) {
      Dictionary&lt;Guid, long&gt; result = null;
      try {
          result = ( from entry in Entries
                     group entry by entry.ListId into listGroup
                     select listGroup ).ToDictionary( grp =&gt; grp.Key, ???? );
  
      } catch ( Exception ex ) {
          . . .
      }
      return result;
  }
  </code></pre>
  
  <p>Remember, I want the count of rows that have each unique ListId returned.  What do I put in place of the "????"?</p>