Q:

How do dynamically set group by properties and aggregates in a LINQ query?

I assume I need to use the method call syntax instead of the query expression form, and I know the basics of grouping in the latter.  Maybe some gurus can give caveats and advice on using group fields and aggregates obtained at runtime from a configuration, for use in a reporting like structure.

A:

Have you looked at Dynamic Linq?  It should do what you want.  Have a look at this post from scottgu's blog.

