我的asp.net mvc应用程序中有4个模型,当我写Update-Database命令时出现错误
在表'Appointments'上引入FOREIGN KEY约束'FK_dbo.Appointments_dbo.Doctors_DoctorId'可能会导致循环或多个级联路径。指定ON DELETE NO ACTION或ON UPDATE NO ACTION,或修改其他FOREIGN KEY约束。 无法创建约束或索引。请参阅先前的错误。
public class Appointment
{
public Appointment()
{
Status = "UnCompleted";
}
[Display(Name = "Appointment Id")]
[Key]
public int AppoiId { get; set; }
[Display(Name = "Patient Id")]
public int PatientId { get; set; }
[ForeignKey("PatientId")]
public virtual Patient Patient { get; set; }
[Display(Name = "Clinic Id")]
public int ClinicId { get; set; }
[ForeignKey("ClinicId")]
public virtual Clinic Clinic { get; set; }
[Display(Name = "Doctor Id")]
public int DoctorId { get; set; }
[ForeignKey("DoctorId")]
public virtual Doctor Doctor { get; set; }
[Required]
[DataType(DataType.Date)]
public string Date { get; set; }
[Required]
[DataType(DataType.Time)]
public string Time { get; set; }
public string Status { get; set; }
}`public class Doctor
{
[Display(Name = "Doctor Id")]
[Key]
public int DoctorId { get; set; }
[Required(ErrorMessage ="Please Enter First Name")]
[Display(Name ="First Name")]
public string FirstName { get; set; }
[Required(ErrorMessage = "Please Enter Last Name")]
[Display(Name = "Last Name")]
public string LastName { get; set; }
[Required(ErrorMessage ="Please Enter Email")]
[EmailAddress]
public string Email { get; set; }
[Required(ErrorMessage ="Please Enter Password")]
[Display(Name ="Password")]
[DataType(DataType.Password)]
[NotMapped]
public string Password { get; set; }
[Required(ErrorMessage = "Please Enter Phone number")]
[Display(Name ="Phone")]
public string Phone { get; set; }
public int ClinicId { get; set; }
[ForeignKey("ClinicId")]
public virtual Clinic Clinic { get; set; }
}`public class Clinic
{
[Key]
[Display(Name = "Clinic Id")]
public int ClinicId { get; set; }
[Required(ErrorMessage ="Please Enter Clinic Name")]
[Display(Name = "Clinic Name")]
public string ClinicName { get; set; }
[Display(Name ="No. of Doctors")]
public int No_Doctors { get; set; }
[Required]
[Display(Name ="Available Time")]
public string Available_time { get; set; }
}`public class Report
{
[Key]
public int ReportId { get; set; }
public int AppoiId { get; set; }
[ForeignKey("AppoiId")]
public virtual Appointment Appointment { get; set; }
public int PatientId { get; set; }
[ForeignKey("PatientId")]
public virtual Patient Patient { get; set; }
public int DoctorId { get; set; }
[ForeignKey("DoctorId")]
public virtual Doctor Doctor { get; set; }
[Required]
public string Symptoms { get; set; }
[Required]
public string Diagnosis { get; set; }
public string Date { get; set; }
[Required]
[Display(Name ="Report Type")]
public Type ReportType { get; set; }
}`
出什么问题了?