0
我想創造我的兩個模型之間的關係是1:0..1但我得到的是1 .. *關係:實體框架1:在MVC 0..1關係5
public class MedicalExamination
{
public int Id { get; set; }
public DateTime EntryDate { get; set; }
public DateTime ExecutionDate { get; set; }
public DateTime AcceptanceDate { get; set; }
public string Description { get; set; }
public string State { get; set; }
public string Result { get; set; }
public string Comment { get; set; }
public virtual Visit Visit { get; set; }
[Required]
public virtual ExaminationDictionary ExaminationDictionary { get; set; }
}
,我的第二個模型:
public class ExaminationDictionary
{
[Key]
public string Code { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public virtual MedicalExamination MedicalExamination { get; set; }
}
後,我跑了它和更新我得到了數據庫這樣的關係:http://scr.hu/11m6/4eny0 的事情是,我想它是0..1:1間的關係。有人知道這個好的解決方案嗎?