Created
January 16, 2014 22:30
-
-
Save lnickers2004/8464784 to your computer and use it in GitHub Desktop.
PAGING:
--GetAll method in RavenDb using LINQ for paging
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 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