2 回答
TA贡献1784条经验 获得超7个赞
解决了
问题解决了,因为我的头脑因尝试了这么多事情而扭曲。这是代码应该是什么。Linq 想要的样子又好又简单:
public ICollection<ACCOUNT_TRANS> GetTransactionsByDate(DateTime date)
{
//Return Transaction history for all changed changed
var results = this.ACCOUNT_TRANS
.Include(at => at.ACCOUNT_TABLE1)
.Include(at => at.ACCOUNT_TABLE2)
.Include(at => at.ACCOUNT_TABLE3)
.Include(at => at.ACCOUNT_TABLE4)
.Where(at => at.COMPLETION_DATE.Value.Day == date.Day &&
at.COMPLETION_DATE.Value.Month == date.Month &&
at.COMPLETION_DATE.Value.Year == date.Year)
.ToList();
return results;
}
TA贡献1830条经验 获得超3个赞
试试这个查询,就这个查询。
var results2 = this.ACCOUNT_TRANS
.Include(at => at.ACCOUNT_TABLE1)
.Include(at => at.ACCOUNT_TABLE2)
.Include(at => at.ACCOUNT_TABLE3)
.Include(at => at.ACCOUNT_TABLE4)
.Where(at => this.ACCOUNT_TRANS
.Where(a => at.COMPLETION_DATE.Value.Day == date.Day &&
a.COMPLETION_DATE.Value.Month == date.Month &&
a.COMPLETION_DATE.Value.Year == date.Year)
.Select(a => a.FK_ACCOUNT).Contains(at.FK_ACCOUNT))
.ToList();
- 2 回答
- 0 关注
- 489 浏览
添加回答
举报