title: Dynamic query with WCF RIA Services
body: <p>I use Silverlight 4 with WCF RIA Services (domain services with EF4). Now I'd like to add a functionality, which allow an user to query data based on the criteria user selected (ad-hoc query). I've found that:</p>
  
  <p>-WCF RIA Services doesn't allow anonymous types, so linq projection isn't possible.</p>
  
  <p>-Exposing OData doesn't help (much), because you can't filter data at client-side.</p>
  
  <p>Searching Internet, it seems I can use dynamic linq library described in the following link:</p>
  
  <p><a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" rel="nofollow">http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx</a></p>
  
  <p>In short, the above link shows how to pass search predicate to server, and execute query at the server-side.
  But how about returning arbitrary data? Anonymous types can't be passed, and I don't want user to retrieve all data, but only those fields user chose. Maybe I should serialize my entity data in domain service and pass it as raw xml? Is it possible? If so, how can I do that?</p>