【发布时间】:2012-07-15 12:09:58
【问题描述】:
我正在尝试在代码优先 EF 中对此进行建模。比赛可以特定于一个国家(例如本地联赛,这也意味着一个大洲)、仅一个大洲(例如欧洲杯)或两者都不是(例如世界杯)
我有一个针对竞赛、国家和大陆的课程。国家和大陆之间存在一对多的关系。我如何为比赛建模?这似乎不正确
public class Competition{
public int CompetitionID { get; set; }
public int Name { get; set; }
public virtual ICollection<Season> Seasons { get; set; }
public Country? Country { get; set; }
public Continent? Continent { get; set;}
}
【问题讨论】:
标签: entity-framework ef-code-first code-first