我有一个linq方法请仔细看看,告诉它有什么问题..........
openQuery = from open in output.result.data
**where open.activity.Contains(open.activity.Where(act => act.action == Action && act.timestamp.Date >= Convert.ToDateTime(DateTime.Now.Date.AddDays(-24))).FirstOrDefault())**
select open;
当注释的where
条件比openQuery
返回REsultView中的Fields时,但当我对其进行注释时它会给出枚举字段错误
答案 0 :(得分:0)
如果您只是在where子句中执行查询:
open.activity.Where(act => act.action == Action
&& act.timestamp.Date >= Convert.ToDateTime(DateTime.Now.Date.AddDays(-24)))
你得到了什么?
答案 1 :(得分:0)
这对你有用。您不需要使用Contains()方法。
openQuery = from open in output.result.data
where open.activity.action == Action && open.activity.action.timestamp.Date >= Convert.ToDateTime(DateTime.Now.Date.AddDays(-24)))
select open;