示例#1
0
        /// <summary>
        /// 获取评论
        /// </summary>
        /// <param name="id">博文编号</param>
        /// <returns></returns>
        public IList <BlogComment> GetComments(Guid id)
        {
            if (!this._commentDic.ContainsKey(id))
            {//本地缓存中没有,另外加载
                BlogStoryPersist.LoadCommentsByStoryID(this._commentDic, id);
            }

            return(this._commentDic[id].ToList());
        }
示例#2
0
        public BlogStoryRepository()
        {
            #region 初始化博文集合
            this._storys         = new HashSet <BlogStory>();
            this._newStorys      = new HashSet <BlogStory>();
            this._modifiedStorys = new HashSet <BlogStory>();
            this._removedStorys  = new HashSet <BlogStory>();
            #endregion

            #region 初始化评论集合
            this._commentDic         = new Dictionary <Guid, HashSet <BlogComment> >();
            this._newCommentDic      = new Dictionary <Guid, HashSet <BlogComment> >();
            this._modifiedCommentDic = new Dictionary <Guid, HashSet <BlogComment> >();
            this._removedCommentDic  = new Dictionary <Guid, HashSet <BlogComment> >();

            #endregion

            this._storys = BlogStoryPersist.GetAll();
        }