from i in Db.Items select new VotedItem { ItemId = i.ItemId, Points = (from v in Db.Votes where b.ItemId == v.ItemId select v.Points).Sum() } 我得到了这个查询,但是如果没有发现有exception的投票则失败: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type. 我假设它是因为sum返回一个int而不是一个可为空的int,给出一个int? 作为input只给出相同的错误,可能导致总和只在整数工作。 任何好的解决方法呢?