title: LINQ to Entities does not recognize the method 'System.Collections.Generic.Dictionary`2[System.Int32,System.String] ToDictionary
body: <p>I am trying to retrieve list of <code>EmployeeDTO</code> from DB which are stored in Employee table. Every employee can have one or more specialty. Specialty are stored in <code>OrganizationSpecialtyType</code>. <code>Employee</code> and <code>OrganizationSpecialtyType</code> are related with "many-to-many" via <code>EmployeeSpecialty</code> table.</p>
  
  <p>I'm using the following query for that, and got an exception like in title:</p>
  
  <pre><code>var q = _context.Employee.Where(p =&gt; employeeEMIIDs.Contains(p.EmployeeID))
              .Select(p =&gt; new EmployeeDTO
                                      {
                                          EmployeeID = p.EmployeeID,
                                          GenderTypeID = p.GenderTypeID,
                                          FirstName = p.FirstName,
                                          LastName = p.LastName,
                                          Name = p.Name,
                                          MiddleName = p.MiddleName,
                                          DOB = p.DOB,
                                          Suffix = p.Suffix,
                                          Title = p.Title,
                                          Specialty = p.EmployeeSpecialty
                                                              .ToDictionary(d =&gt; d.OrganizationSpecialtyType.SpecialtyTypeID, d =&gt; d.OrganizationSpecialtyType.Name)
                                      }
                          );
  </code></pre>
  
  <p>In the <code>EmployeeDTO</code> class the property <code>Specialty</code> is type <code>public Dictionary&lt;int, string&gt;</code>.</p>
  
  <p>If I execute this query, everything works normally:</p>
  
  <pre><code>var spec = _context.Employee.Where(p =&gt; p.EmployeeID == -9070).FirstOrDefault()
      .EmployeeSpecialty.ToDictionary(d =&gt;
           d.OrganizationSpecialtyType.SpecialtyTypeID,
           d =&gt; d.OrganizationSpecialtyType.Name);
  </code></pre>
  
  <p>How I can solve my first query to obtain <code>EmployeeDTO</code> with specialties?</p>
  
  <p>Thanks.</p>