开发者

Can I use Entity SQL to query an IQueryable<T>?

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 selectin开发者_C百科g 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜