Beispiel #1
0
        // [START list]
        public BookList List(int pageSize, string nextPageToken)
        {
            var query = _db.CreateQuery <Book>();

            query.Limit = pageSize;
            if (!string.IsNullOrWhiteSpace(nextPageToken))
            {
                query.StartCursor = ByteString.FromBase64(nextPageToken);
            }
            var results = _db.RunQuery(query);

            return(new BookList()
            {
                Books = results.Entities <Book>(),
                NextPageToken = results.Entities.Count == query.Limit ?
                                results.EndCursor.ToBase64() : null
            });
        }