通常、BLToolKit を使用すると、次の方法で DB からデータをフェッチします。
using ( DbManager db = new MyDbManager() )
{
IList<MyObjects> objects = db
.SetCommand(query)//sometimes with additional parameters
.ExecuteList<MyObjects>()
;
}
私は次のことを行う能力を持ちたいと思っています:
using ( DbManager db = new MyDbManager() )
{
IQueryable<MyObjects> qObjs = db
.SetCommand(query)//sometimes with additional parameters
.ExecuteQuery<MyObjects>()// here I don't want query actually to be executed
;
// ... another logic, that could pass qObj into other part of program
IList<MyObjects> objects = qObjs
.Where(obj=>obj.SomeValue>=SomeLimit) // here I want to put additional filters
.ExecuteList() // and only after that I wan't to execute query and fetch results
;
}
元のクエリ文字列を変更する (WHERE 部分を変更する) ことで回避できますが、かなり複雑な場合があります。
それを行う簡単な方法はありますか?
ありがとう。どんな考えでも大歓迎です!