ASP.NET MVC跟随与跟随系统

iecba09b  于 2022-12-30  发布在  .NET
关注(0)|答案(1)|浏览(152)

我将开发一个系统,用户可以在ASP.NET MVC中互相跟随。我该怎么做呢?
我以前从没玩过多对多的游戏

namespace EntityLayer.Concrete
{
    public partial class Follow
    {
        [Key]
        public int FollowID { get;set;}
        
        public int UserOneID { get;set;}

        public int UserTwoID { get;set;}
        
        public bool IsFollowing { get;set;}

        public virtual Author Author { get; set; }
        public virtual Author user { get; set; }
        public virtual Author user2 { get; set; }
    }
}
vc9ivgsu

vc9ivgsu1#

你不需要那么多字段,这些应该足够了

amespace EntityLayer.Concrete
{
    public partial class Follow
    {
        [Key]
        public int ID { get;set;} //  instead you can make a composit key from AuthorID and FollowerID together

        public int AuthorID { get;set;}
        public int FollowerID { get;set;}

      
        public bool IsFollowing { get;set;} // I am not sure you really need it, only if you want to keep a history

        public virtual Author Author { get; set; }
        public virtual Author Follower { get; set; }
       
    }
}

相关问题