I've made some changes to my EF code first database and when I try to update it I now get the following error:
Introducing FOREIGN KEY constraint 'FK_dbo.SupportTicketMessages_dbo.SupportTickets_Ticket_Id' on table 'SupportTicketMessages' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Here are my entities:
SupportTicket:
public class SupportTicket
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public string Title { get; set; }
[Required]
public string Text { get; set; }
[Required]
public TicketUrgency Urgency { get; set; }
[Required]
public TicketStatus Status { get; set; }
[Required]
public virtual UserProfile Owner { get; set; }
[Required]
public DateTime Date { get; set; }
}
SupportTicketMessage:
public class SupportTicketMessage
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public virtual UserProfile Author { get; set; }
[Required]
public string Text { get; set; }
[Required]
public DateTime Date { get; set; }
[Required]
public virtual SupportTicket Ticket { get; set; }
[Required]
public int MessageNumber { get; set; }
}
What's the issue here? I don't see what's wrong.