I'm trying to create a double relationship. Lets say its a Team and Players - a Team has many Players but only one captain
public class Team { public int Id { get; set; } public virtual ICollection<Player> Players { get; set; } public Player Captain { get; set; } public int CaptainId { get; set; } } public class Player { public int Id { get; set; } public string Name { get; set; } [InverseProperty("Players")] public virtual Team Team { get; set; } public int TeamId { get; set; } }
When running update-database this is resulting in an error along the lines of The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.Teams_dbo.Players_TeamId". The conflict occurred in database "dev", table "dbo.Players", column 'Id'. (I'm translating from my real classnames/fields)