I just tried out the dynamic linq library Scott Gu released quite awhile ago, and I'm having some problems with it. One of my Views allows users to choose which columns to display and what to order by. So, I have code like this:
// 'SerializeToCsv' is a helper method I set up for List<string> collections.
var projects = context.s_Projects
.Select("new(" + columns.SerializeToCsv() + ")");
This builds the query just fine, but here's the rub - I want the actual data, not the query. I thought that, after running the Select, I would get the data returned to me, but this was not correct. In Scott Gu's example, he unfortunately uses a Web Forms databinding example, which is completely useless for me. I'm not databinding this query to a web control, I just need the data. There aren't any methods I can tack on like "ToList" to get it to resolve, so what do I need to do to make the query run?
View Complete Post