How should I model friendships between users with EF code first?
问题 I'm tring to figure out how to represent friendships between users with Entity Framework (5) Code First. My initial idea was to create a class Friendship which contains references to two User instances, so that friendships are represented by separate objects. public class Friendship { public virtual int Id { get; set; } [Required] public virtual UserProfile User1 { get; set; } [Required] public virtual UserProfile User2 { get; set; } [Required] public virtual DateTime Since { get; set; } }