title: Projecting into KeyValuePair via EF / Linq
body: <p>I'm trying to load a list of KeyValuePairs from an EF / Linq query like this:  </p>
  
  <pre><code>return (from o in context.myTable 
  select new KeyValuePair&lt;int, string&gt;(o.columnA, o.columnB)).ToList();
  </code></pre>
  
  <p>My problem is that this results in the error </p>
  
  <blockquote>
    <p>"Only parameterless constructors and initializers are supported in
    LINQ to Entities."</p>
  </blockquote>
  
  <p>Is there an easy way around this? I know I could create a custom class for this instead of using KeyValuePair but that does seem like re-inventing the wheel.</p>