Optimized Blog Post counting

--HG--
branch : dev
This commit is contained in:
Sebastien Ros 2010-07-21 13:10:22 -07:00
parent cae7f5852e
commit 873ab417d7

View File

@ -35,8 +35,8 @@ namespace Orchard.Blogs.Handlers {
// Ensure we get the "right" set of published posts for the blog
blog.ContentItem.ContentManager.Flush();
var posts = _blogPostService.Get(blog, VersionOptions.Published).ToList();
blog.PostCount = posts.Count;
var postsCount = _blogPostService.Get(blog, VersionOptions.Published).Count();
blog.PostCount = postsCount;
});
OnInitializing<BlogPost>((context, bp) => {