まず最初に、私はこの質問をよく目にすることを述べたいと思います。重複する可能性があることは理解していますが、検索して検索しましたが、正しい解決策が見つかりませんでした。
public class Members
{
public enum Statuses
{
APPLIED,
ACTIVE,
SUSPENDED,
DELETED
}
[Key]
public int ID { get; set; }
[Required]
public string UName { get; set; }
public int RecruiterID { get; set; }
public int AuditorID { get; set; }
public virtual ICollection<AuditorComments> AuditorComments { get; set; }
[Required]
public Statuses Status { get; set; }
[Timestamp]
public Byte[] Timestamp { get; set; }
[ForeignKey("RecruiterID")]
public virtual Members Recruiter { get; set; }
[ForeignKey("AuditorID")]
public virtual Members Auditor { get; set; }
}
基本的に、外部キーを正しく結び付けていますか?
これが私が受け取っているエラーです:
Unable to determine the principal end of an association between the types
'tn.Data.Members' and 'tn.Data.Members'. The principal end of this association
must be explicitly configured using either the relationship fluent API or data
annotations.
このようなテーブルは他にもたくさんありますが、これを機能させることができれば、それらすべてを修正できます。