4
我想動態地構建我的where條件列表。這裏是我的代碼片段:Linq-to-entities中的組合謂詞
protected Expression<Func<event_info, bool>> _wherePredicate = c => true;
public void main()
{
_wherePredicate = _wherePredicate.And(c => c.createdby == 6);
_wherePredicate = _wherePredicate.And(c => c.isdeleted == 0);
var query = from ev in dataConnection.event_info
where ev.isdeleted == 0
select ev;
Results = query.Where(_wherePredicate).ToList();
}
除非這不起作用,因爲linq-to-entities不支持Invoke方法。
什麼是一種好的方法,我可以在linq-to-entities中結合謂詞?
[LINQ實體:結合謂詞](http://blogs.msdn.com/b/meek/archive/2008/05/02/linq-to-entities - 組合-predicates.aspx) –