title: Nested query using Linq with ToDictionary
body: <p>I'm having problems with this query using entity framework 4:</p>
  
  <pre><code>List&lt;SomeResult&gt; test = (from a in _entities.TableA
                           select new SomeResult
                           {
                              TestB = a.TableB.Name,
                              TestCDict = a.TableC.ToDictionary(x =&gt; x.SomeKey, x =&gt; x.SomeValue)
                            }).ToList();
  </code></pre>
  
  <p>It gives this error: </p>
  
  <p>"Cannot compare elements of type 'System.Data.Objects.DataClasses.EntityCollection`1'. Only primitive types (such as Int32, String, and Guid) and entity types are supported."</p>
  
  <p>How can I redo this query so it'll work? from a in _entities.TableA from c in a.TableC ....ToDictionary(.. ?</p>
  
  <p>/Lasse</p>