Когда я обновляю базу данных в консоли диспетчера пакетов, у меня появляется эта ошибка
Введение ограничения FOREIGN KEY 'FK_dbo.Appointments_dbo.Users_AppointmentManagerId' в таблице 'Назначения' может привести к циклам или нескольким каскадным путям. Укажите ON DELETE NO ACTION или ON UPDATE NO ACTION или измените другие ограничения FOREIGN KEY. Не удалось создать ограничение или индекс. Смотрите предыдущие ошибки.
Мои занятия
[Table("Appointments")]
public class Appointment
{
#region property
[Key]
public int Id { get; set; }
[Required]
[MaxLength(200)]
public string Subject { get; set; }
[Required]
[MaxLength(500)]
public string Description { get; set; }
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy hh:mm tt")]
public DateTime StarTime { get; set; }
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy hh:mm tt")]
public DateTime EndTime { get; set; }
public String Location { get; set; }
#endregion
#region relationship
[ForeignKey("AppointmentCustomer")]
public int AppointmentCustomerId { get; set; }
[ForeignKey("AppointmentManager")]
public int AppointmentManagerId { get; set; }
public virtual Users AppointmentCustomer { get; set; }
public virtual Users AppointmentManager { get; set; }
#endregion
}
[Table("Users")]
public class Users
{
#region property
[Key]
public int Id { get; set; }
[Required]
public string IDUser { get; set; }
[Required]
public string Email { get; set; }
#endregion
#region relationship
[InverseProperty("TicketDeveloper")]
public virtual ICollection<Ticket> TicketDevelopers { get; set; }
[InverseProperty("TicketTester")]
public virtual ICollection<Ticket> TicketTesters { get; set; }
[InverseProperty("ProjectCustomer")]
public virtual ICollection<Project> ProjectCustomers { get; set; }
[InverseProperty("ProjectManager")]
public virtual ICollection<Project> ProjectManagers { get; set; }
[InverseProperty("NoteTester")]
public virtual ICollection<Note> NoteTesters { get; set; }
[InverseProperty("CaseCustomer")]
public virtual ICollection<Case> CaseCustomers { get; set; }
[InverseProperty("AppointmentCustomer")]
public virtual ICollection<Appointment> AppointmentCustomers { get; set; }
[InverseProperty("AppointmentManager")]
public virtual ICollection<Appointment> AppointmentManagers { get; set; }
#endregion
}