这是我的问题:
我有一个IQueryable
对象,我需要在我的IQueryable
obj中启动相同的包含查询,在Db上执行新查询(就像刷新一样)。
一个例子:
myObj = objCtx.Person
.Where(p => p.IdPerson...)
.OrderBy(p => ...)
.Select(..some field..);
//...
// From another function I just want re-execute
// the same query
// -> Well, that retrieve full lambda
var et = this.myObj.Expression
// This doesn't work:
var anotherObj = objCtx.Person.Where(et);
//or..
var tmp = Expression.Lambda<Func<T, bool>>(et);
// This doesn't work too:
var anotherObj = objCtx.Person.Where(tmp);
有可能实现吗?我错过了什么?
由于
OK: 我将能够从IQueryable对象中检索完整查询(select语句)并执行它以获取我所有更新的数据。
这是原始查询:
this.myIQueryableObj = objCtx.Person
.Where(p => p.IdPerson...)
.OrderBy(p => ...)
.Select(..some field..);
//..And in some button click, I want execute again the above query, but all what I know is myIQueryableObjOnly. Can you help me?