包括matchparticipants不工作.我在调试时总是说Null.但是,当我将GroupBy置于评论中时,它可以正常工作.我使用实体框架4.3.1与代码优先.
实体:
public class Match
{
[ScaffoldColumn(false)]
public int MatchId { get; set; }
[Required(ErrorMessage = "Matchtype is a required field")]
public int Scheme { get; set; }
[Required]
[DefaultValue(false)]
public bool Finished { get; set; }
public int Round { get; set; }
// Relations
[Required]
public Category Category { get; set; }
public Official Official { get; set; }
public Slot Slot { get; set; }
public ICollection<MatchParticipant> MatchParticipants { get; set; }
}
public class MatchParticipant
{ …Run Code Online (Sandbox Code Playgroud)