我可以使用 Entity SQL 查询 IQueryable吗?

发布于 2024-10-24 03:38:21 字数 826 浏览 1 评论 0原文

我知道我可以使用 ESQL 查询 T 的 ObjectSet,但我可以使用它查询 T 的任意 IQueryable 吗?

EDIT

示例:

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

实际上,用例如下:我需要程序员编写一个返回表示核心查询的 IQueryable(T) 的方法。该查询将被提供给 ReportControl,该 ReportControl 必须对此查询执行一系列分组依据,以及选择必须检索哪些列等。我认为通过 ESQL 动态操作核心查询是一个不错的选择。我也不确定。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

轻许诺言 2024-10-31 03:38:22

检查 动态 Linq 库。它是 Visual studio 2008 示例的一部分,但它适用于 2010以及。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文