0

I know I can use ESQL to query an ObjectSet of T but can I use it to query an arbitrary IQueryable of T?

EDIT

Example:

var originalQuery = from t in Transactions where t.Date < DateTime.Now select t;

// query is now an IQueryable<Transation>. Now I want to do some dynamic manipulations
// on originalQuery by using ESQL

var manipulationQuery = "select t.a as A from T as t";

// I want to execute manipulationQuery over the originalQuery, something like this:
// (this is a hipotetical method. It does not exist)
var transactions = context.RunESQLOverIQueryable(originalQuery, manipulationQuery).ToList();

EDIT 2

Actually the use case is the following: I need a programmer to code a method that returns an IQueryable(T) representing the core query. This query will be given to a ReportControl that must execute a series of group bys on this query, as well as selecting which columns must be retrieved and so forth. I thought that manipulating the core query dynamically through ESQL is a good choice. I'm not sure either.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
  • 1
    Sorry, can't think - what's Entity SQL in this context? If you're using EF then most IQueryables you get can be cast back to ObjectQuerys and you can then use the methods again. – Rup Mar 17 '11 at 11:37
  • OK, thanks - so there's a non-hypothetical method that does the same thing over an ObjectQuery? (Do [EntityCommand](http://msdn.microsoft.com/en-us/library/bb343124.aspx)s do that?) – Rup Mar 17 '11 at 12:16
  • @Rup: Thank you for your reply. I don't think this string predicate Where method helps me solving my problem. I have once again edited the question with additional informations. Thank you. – Andre Pena Mar 17 '11 at 12:25

1 Answers1

1

Check Dynamic Linq library. It is part of samples for Visual studio 2008 but it will work with 2010 as well.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670