query using dynamic linq

.net dynamic-data dynamic-linq linq

Question

I have query to perform where the user will enter at runtime one of the columns to be included in the result set. And, I won't know until runtime how many columns he could choose from (he uploads a file that can contain a varying number of columns). I'd like to write the query where the index of the column is dynamic. What's the best way to do this kind of query?

Thanks.

1
1
11/25/2010 3:24:41 AM

Accepted Answer

You're looking for Dynamic LINQ.

Alternatively, you could generate expression trees from the column names and call ThenBy in a loop.

3
11/25/2010 3:23:49 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow