Created
October 8, 2012 13:21
-
-
Save jbogard/3852502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListPostsQuery | |
{ | |
private readonly IDocumentSession session; | |
public ListPostsQuery(IDocumentSession session) | |
{ | |
this.session = session; | |
} | |
public List<Post> Execute(int currentPage, int defaultPage, int pageSize, out RavenQueryStatistics stats) | |
{ | |
return session.Query<Post>() | |
.Include(x => x.AuthorId) | |
.Statistics(out stats) | |
.WhereIsPublicPost() | |
.OrderByDescending(post => post.PublishAt) | |
.Paging(currentPage, defaultPage, pageSize) | |
.ToList(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment