Entity Framework Core
Throwing error while doing update-database
Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table 'UserRoleRelationship' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index.
public class UserRoleRelationship
{
[Key]
public int Id { get; set; }
[Required]
public Guid UserRoleRelationshipId { get; set; }
public virtual UserRole ChildUserRole { get; set; }
public int ChildUserRoleId { get; set; }
public virtual UserRole ParentUserRole { get; set; }
public int ParentUserRoleId { get; set; }
}
public class UserRole
{
[Key]
public int Id { get; set; }
[Required]
public Guid UserRoleId { get; set; }
public virtual Role Role { set; get; }
public int RoleId { set; get; }
public virtual U.User User { set; get; }
public int UserId { set; get; }
}