2
我先使用Entity Framework 6代码。我有三个实体这样的:'PK_dbo.EntityName'不是一个约束。无法删除约束.EF6
public class Doctor
{
public string DoctorID { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
}
public class ExpertiseDetails
{
[Key, Column(Order = 1)]
public short expertiseID { get; set; }
[Key , Column(Order = 2)]
public string DoctorID { get; set; }
[ForeignKey("expertiseID")]
public Expertise expertise { get; set; }
public Doctor doctor { get; set; }
}
public class Expertise
{
[Key]
public short expertiseID { get; set; }
public string expertiseTitle { get; set; }
}
我需要Expertise
和Doctor
之间的one to many
赫志,当我在控制台nuGet
运行更新数据库语句此错误显示:
'PK_dbo.ExpertiseDetails' is not a constraint. Could not drop constraint
有什么不对?
我想你有你的分贝数据,请删除数据,然后再试 – Moein
@Moein。我尝试了你的建议,但它不起作用! – Majid