在我搭建了这个模型之后,MVC4 Visual Studio 中的脚手架功能不包括上下文类中的“CompatibleGames”类:
public string Name { get; set; }
public int CategoryId { get; set; }
public int CompatibleGamesId { get; set; }
public string Description { get; set; }
public string ImageUrl { get; set; }
public int TotalDownloads { get; set; }
[Range(0,5)]
public int RatingOutOf5 { get; set; }
[ForeignKey("CompatibleGamesId")]
public List<CompatibleGames> compatibleGames { get; set; }
[ForeignKey("CategoryId")]
public Category modCategory { get; set; }
[Key]
public int ItemID { get; set; }
尽管当我将 CompatibleGames 属性更改为单个实例时,它确实在上下文类中包含了 CompatibleGames 模式:
public string Name { get; set; }
public int CategoryId { get; set; }
public int CompatibleGamesId { get; set; }
public string Description { get; set; }
public string ImageUrl { get; set; }
public int TotalDownloads { get; set; }
[Range(0,5)]
public int RatingOutOf5 { get; set; }
[ForeignKey("CompatibleGamesId")]
public CompatibleGames compatibleGames { get; set; }
[ForeignKey("CategoryId")]
public Category modCategory { get; set; }
[Key]
public int ItemID { get; set; }
有什么方法可以保留 List 属性,同时让脚手架功能将 CompatibleGames 模型添加到上下文类中?