title: groupby multiple columns in a F# 3.0 query
body: <p>Just trying out F# 3.0 and hit a bit of a wall when it comes to grouping by multiple columns. The obvious thing to try was</p>
  
  <pre><code>query {
      for d in context.table do
      groupBy (d.col1,d.col2) into g
      select (g.Key)
  }
  </code></pre>
  
  <p>But I get a "Only parameterless constructors and initializers are supported in LINQ to Entities." exception.</p>
  
  <p>I can't seem to find an example on msdn</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/hh225374(v=vs.110).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/hh225374(v=vs.110).aspx</a></p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/hh361035(v=vs.110).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/hh361035(v=vs.110).aspx</a></p>
  
  <p>And I realize my question is similar to 
  " <a href="https://stackoverflow.com/q/8546823/926042">Entity Framework and Anonymous Types in F#</a>" but it seems to be powerpack/F#2.x focused and I'm hoping F# 3.0 has an elegant answer... Any ideas?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I came across the CLIMutable attribute from reading Brian's post at:</p>
  
  <p><a href="http://blogs.msdn.com/b/fsharpteam/archive/2012/07/19/more-about-fsharp-3.0-language-features.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/fsharpteam/archive/2012/07/19/more-about-fsharp-3.0-language-features.aspx</a></p>
  
  <p>I was pretty optimistic so I tried</p>
  
  <pre><code>[&lt;CLIMutable&gt;]
  type MyRecord = { Column1 : int; Column2 : int }
  
  query {
      for d in context.table do
      groupBy {Column1 = col1; Column2 = col2} into g
      select (g.Key)
  }
  </code></pre>
  
  <p>Unfortunately I get the exact same exception.</p>