I am using Identity 3
in ASP.NET 5 RC1/Core
I need to create a foreign key reference in the ApplicationUser that refers to the primary key of the ApplicationUser(IdentityUser) using EF Code First
.
I have tried
public class ApplicationUser : IdentityUser
{
[Column("fk_LineManagerUserId")]
public Guid LineManagerUserId { get; set; }
[ForeignKey("LineManagerUserId")]
public virtual ApplicationUser LineManagerUser { get; set; }
}
or
public class ApplicationUser : IdentityUser
{
[Column("fk_LineManagerUserId")]
public string LineManagerUserId { get; set; }
[ForeignKey("LineManagerUserId")]
public virtual ApplicationUser LineManagerUser { get; set; }
}
but I get
Introducing FOREIGN KEY constraint 'FK_ApplicationUser_ApplicationUser_LineManagerUserId' on table 'AspNetUs ers' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.