- C# code
var query = User.GroupJoin(Charge, u => u.Account, c => c.Account, (u, c) => new { u, c }).Select(data => new AnalysisPlayer { Account = data.u.Account, PlayerName = data.u.Name, RegTime = data.u.CreateTime ?? DateTime.Now, Points = 此处如何写代码 });public class AnalysisPlayer{ /// <summary> /// 玩家名称 /// </summary> public string PlayerName { get; set; } /// <summary> /// 玩家账号 /// </summary> public string Account { get; set; } /// <summary> /// 注册时间 /// </summary> public DateTime RegTime { get; set; } /// <summary> /// 充值总数 /// </summary> public int Points { get; set; }}
------解决方案--------------------------------------------------------
var query = User.GroupJoin(Charge, u => u.Account, c => c.Account, (u, c) => new { u, c })
.Select(data => new AnalysisPlayer { Account = data.u.Account, PlayerName = data.u.Name,
RegTime = data.u.CreateTime ?? DateTime.Now, Points =data.c==null?0:data.c.Points });