Skip to content

Instantly share code, notes, and snippets.

@lnickers2004
Created January 16, 2014 22:30
Show Gist options
  • Select an option

  • Save lnickers2004/8464784 to your computer and use it in GitHub Desktop.

Select an option

Save lnickers2004/8464784 to your computer and use it in GitHub Desktop.
PAGING: --GetAll method in RavenDb using LINQ for paging
public static List<EventData> GetAll()
{
using (var session = store.OpenSession())
{
RavenQueryStatistics stats;
// get the first page
var results = session.Query<EventData>()
.Statistics(out stats)
//.Skip(0 * 10) // retrieve results for the first page
//.Take(20) // page size is 20
//.Where(x => x.Make == "Ford")
.Distinct().ToList();
var totalResults = stats.TotalResults;
var skippedResults = stats.SkippedResults;
return results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment