セットにはカードとセットがあります。EFコードファーストを使用して、モデルにあるものは次のとおりです。
public class Set
{
// Primitive Properties
[Required]
[Key]
public virtual int SetId { get; set; }
// Navigation Properties
[Required]
public virtual List<Set> Sets { get; set; }
// Navigation Properties
[ForeignKey("ParentSet")]
public int ParentSetId { get; set; }
public virtual Set ParentSet { get; set; }
}
次にカードの場合:
public class Card
{
// Primitive Properties
[Required]
[Key]
public virtual int CardId { get; set; }
// Navigation Properties
[Required]
[ForeignKey("ParentSet")]
public int ParentSetId { get; set; }
public virtual Set ParentSet { get; set; }
}
パッケージマネージャーコンソールから「update-database」を使用してデータベースを再構築しようとしていますが、これは次のエラーです。
'App.Core.Set_ParentSet'関係のプリンシパルエンドを判別できません。追加された複数のエンティティが同じ主キーを持つ場合があります。
なぜですか?