需求 开发关注、取消关注功能。 统计用户的关注数、粉丝数。 关键 若A关注了B,则A是B的Follower(粉丝),B是A的Followee(目标)。 关注的目标可以是用户、帖子、题目等,在实现时将这些目标抽象为实体。 一、增加相应的key 关注的除了用户,也可能是帖子等,生成Follower和Followee
1、新建interface public interface ISoftDelete { public bool isdeleted { get; set; } } 2、需要使用到软删除的entity要继承这个interface 3、然后在DBContext的OnModelCreating中为每个继承了ISoftDelete的entity添加过滤器 protected override void OnModelCreating(Mo
关注 需求 开发关注、取消关注功能。 统计用户的关注数、粉丝数。 关注 若A关注了B,则A是B的Follower(粉丝),B是A的Followee(目标)。 关注的目标可以是用户、帖子、题目等,在实现时将这些目标抽象为实体。 修改RedisKeyUtil public class RedisKeyUtil { private static
显示评论 数据层 根据实体查询一页评论数据。 根据实体查询评论的数量。 业务层 处理查询评论的业务。 处理查询评论数量的业务。 表现层 显示帖子详情数据时,同时显示该帖子所有的评论数据。 1、实体类: public class Comment { private int id; private int u