我有一个类,我用它来存储不同赛季的球员统计数据
public class PlayerModel
{
public int PlayerID { get; set; }
public Dictionary<int, SeasonStats> SeasonStats { get; set; }
public PlayerModel()
{
this.SeasonStats = new Dictionary<int, SeasonStats>();
//Add season stats for each year
this.SeasonStats.Add(2012, new SeasonStats());
this.SeasonStats.Add(2011, new SeasonStats());
this.SeasonStats.Add(2010, new SeasonStats());
}
}
public class SeasonStats
{
public int Goals { get; set; }
public int Assists { get; set; }
}
我想使用 Entity Framework 来存储对象,但我不确定要在 SeasonStats 属性上放置哪些属性才能让 Entity 正确存储对象。