예제 #1
0
 public IPageOfItems <Post> GetPostsByFileType(PagingInfo pagingInfo, string typeName)
 {
     return(cache.GetItems <IPageOfItems <Post>, Post>(
                string.Format("GetPostsWithDrafts-FileType:{0}", typeName),
                pagingInfo.ToCachePartition(),
                () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPostsByFiles(pagingInfo, getFiles(typeName)).FillTags(tagService).FillComments(commentService)),
                p => p.GetDependencies()
                ));
 }
예제 #2
0
 public IPageOfItems <Post> GetPostsWithDrafts(PagingInfo pagingInfo)
 {
     return(cache.GetItems <IPageOfItems <Post>, Post>(
                "GetPostsWithDrafts",
                pagingInfo.ToCachePartition(),
                () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPosts(pagingInfo, true).FillTags(tagService).FillComments(commentService)),
                p => p.GetDependencies()
                ));
 }
예제 #3
0
 public IPageOfItems <Post> GetPostsWithDrafts(PagingInfo pagingInfo, Blog blog)
 {
     return(cache.GetItems <IPageOfItems <Post>, Post>(
                string.Format("GetPostsWithDrafts-{0}", blog.GetCacheItemKey()),
                pagingInfo.ToCachePartition(),
                () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPostsWithDrafts(pagingInfo, blog).FillTags(tagService).FillComments(commentService)),
                p => p.GetDependencies()
                ));
 }
예제 #4
0
 public IPageOfItems <Post> GetPosts(PagingInfo pagingInfo, ArchiveData archive)
 {
     return(cache.GetItems <IPageOfItems <Post>, Post>(
                string.Format("GetPosts-Year:{0},Month:{1},Day:{2}", archive.Year, archive.Month, archive.Day),
                pagingInfo.ToCachePartition(),
                () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPostsByArchive(pagingInfo, archive.Year, archive.Month, archive.Day).FillTags(tagService).FillComments(commentService)),
                p => p.GetDependencies()
                ));
 }
예제 #5
0
 public IPageOfItems <PostComment> GetComments(PagingInfo pagingInfo, Tag tag)
 {
     return(cache.GetItems <IPageOfItems <PostComment>, PostComment>(
                string.Format("GetComments-{0}", tag.GetCacheItemKey()),
                pagingInfo.ToCachePartition(),
                () => processDisplayOfComments(() => getComments(blogsCommentRepository.GetComments(pagingInfo, tag))),
                c => getCommentDependencies(c, tag)
                ));
 }
예제 #6
0
 public IPageOfItems <PostComment> GetComments(PagingInfo pagingInfo, Post post, bool includeUnapproved)
 {
     return(cache.GetItems <IPageOfItems <PostComment>, PostComment>(
                string.Format("GetComments-{0},IncludeUnapproved:{1}", post, includeUnapproved),
                pagingInfo.ToCachePartition(),
                () => processDisplayOfComments(() => getComments(blogsCommentRepository.GetComments(pagingInfo, post, includeUnapproved))),
                c => getCommentDependencies(c, post)
                ));
 }
예제 #7
0
 public IPageOfItems <PostComment> GetComments(PagingInfo pagingInfo, bool includePending, bool sortDescending)
 {
     return(cache.GetItems <IPageOfItems <PostComment>, PostComment>(
                string.Format("GetComments-IncludePending:{0},SortDescending{1}", includePending, sortDescending),
                pagingInfo.ToCachePartition(),
                () => processDisplayOfComments(() => getComments(blogsCommentRepository.GetComments(pagingInfo, includePending, sortDescending))),
                c => getCommentDependencies(c, new SiteSmall(context.Site.ID))
                ));
 }
예제 #8
0
 public IPageOfItems <ScheduleItem> GetScheduleItemsByFlag(PagingInfo pagingInfo, Event evnt, string flagName)
 {
     return
         (cache.GetItems <IPageOfItems <ScheduleItem>, ScheduleItem>(
              string.Format("GetScheduleItems-Event:{0},Flag:{1}", evnt.Name, flagName),
              pagingInfo.ToCachePartition(),
              () => repository.GetScheduleItemsByFlag(pagingInfo, evnt, flagName).FillTags(tagService),
              si => si.GetDependencies()
              ));
 }
예제 #9
0
        public IPageOfItems<ISearchResult> GetSearchResults(PagingInfo pagingInfo, SearchCriteria criteria)
        {
            IPageOfItems<ISearchResult> searchResults =
                cache.GetItems<IPageOfItems<ISearchResult>, ISearchResult>(
                    string.Format("GetPosts-SearchTerm:{0}", criteria.Term),
                    pagingInfo.ToCachePartition(),
                    () => repository.GetSearchResults(pagingInfo, criteria),
                    null
                    );

            //if (context.RequestDataFormat.IsFeed())
            //    searchResults = searchResults.Since(context.RequestContext.HttpContext.Request.IfModifiedSince());

            pluginEngine.ExecuteAll("UserSearched", new { context, criteria });

            return searchResults;
        }
예제 #10
0
        public IPageOfItems <Post> GetPosts(PagingInfo pagingInfo, Blog blog)
        {
            IPageOfItems <Post> posts =
                cache.GetItems <IPageOfItems <Post>, Post>(
                    string.Format("GetPosts-{0}", blog.GetCacheItemKey()),
                    pagingInfo.ToCachePartition(),
                    () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPosts(pagingInfo, blog).FillTags(tagService).FillComments(commentService)),
                    p => p.GetDependencies()
                    );

            if (context.RequestDataFormat.IsFeed())
            {
                posts = posts.Since(p => p.Published.Value, context.HttpContext.Request.IfModifiedSince());
            }

            return(posts);
        }
예제 #11
0
        public IPageOfItems <Post> GetPosts(PagingInfo pagingInfo)
        {
            bool includeDrafts        = context.RequestDataFormat == RequestDataFormat.Web && context.User.IsAuthenticated && context.User.IsInRole("Admin");
            IPageOfItems <Post> posts =
                cache.GetItems <IPageOfItems <Post>, Post>(
                    string.Format("GetPosts-IncludeDrafts:{0}", includeDrafts),
                    pagingInfo.ToCachePartition(),
                    () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPosts(pagingInfo, includeDrafts).FillTags(tagService).FillComments(commentService)),
                    p => p.GetDependencies()
                    );

            if (!includeDrafts)
            {
                posts = posts.Since(p => p.Published.Value, context.HttpContext.Request.IfModifiedSince());
            }

            return(posts);
        }