I have a User entity in my DbContext. What I want is that users should be able to give references/leave comments for each other, therefore I have created Reference entity.
public class Reference
{
public virtual User By { get; set; } // user who leaves a reference
public virtual User To { get; set; } // user who has given a reference
public string Opinions { get; set; }
}
in User entity
public virtual ICollection<Reference> ReferencedTo { get; set; } // collection of references that user has given
public virtual ICollection<Reference> ReferencedBy { get; set; } // collection of references that user has been given
What should I do to make it work with either DataAnnonations or FluentAPI, or how would you approach to this and solve?