1
类
我查询一个EF实体MatchHistory:集团LINQ和返回为
public partial class MatchHistory
{
public System.Guid ApplicantId { get; set; }
public int BuyerId { get; set; }
public System.DateTime AppliedOn { get; set; }
public int MatchResultId { get; set; }
public System.DateTime ReapplyOn { get; set; }
public virtual MatchBuyer MatchBuyer { get; set; }
}
目前,我有我的代码这个LINQ声明。
return r.Find()
.Where(x => x.AppliedOn > cutoff && x.MatchResultId == (int)MatchResult.Accepted)
.ToList();
这将返回符合条件的MatchHistory类型的所有行。
但是,我想要做的是按BuyerId分组并返回由BuyerId计数。
这里的课,我想输出:
public class QuotaCount
{
public int BuyerId { get; set; }
public int Count { get; set; }
}
还没有完全成功地得到正确的语法在一起,但 - 知道的任何建议。