public
Last active

  • Download Gist
Query.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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();
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.