对不起,如果这个问题早先解决了。
我有一个简单的代码可以让事情变得容易理解
public class Treatment
{
public int Id { get; set; }
public List<string> Issue { get; set; }
public List<string> Medicine { get; set; }
public List<string> Test { get; set; }
public Doctor Doctor { get; set; }
public Patient Patient { get; set;
}
Add-Migrationa 和 Update-Database 之后
桌子的设计是这样的——
[dbo].[Treatments](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Doctor_Id] [int] NULL ForeignKey,
[Patient_Id] [int] NULL ForeignKey
列出医学,测试等项目发生了什么。
顺便说一句,我正在研究 EF6。