Ejemplo n.º 1
0
        private static async Task GetAllUsers(Container dsc)
        {
            DataServiceQuery <User> query = dsc.CreateQuery <User>("Users");

            query = query.IncludeTotalCount();
            //var response1 = await query.ExecuteAsync();
            QueryOperationResponse <User> response = await query.ExecuteAsync() as QueryOperationResponse <User>;

            Console.WriteLine($"There are a total of {response.TotalCount} Users.");
            foreach (var res in response)
            {
                Console.WriteLine(res.Name);
            }
        }
Ejemplo n.º 2
0
        // Private method that returns the page-specific query.
        private DataServiceQuery <Title> GetQuery()
        {
            // Get a query for the Titles feed from the context.
            DataServiceQuery <Title> query = _context.Titles;

            if (_currentPage == 0)
            {
                // If this is the first page, then also include a count of all titles.
                query = query.IncludeTotalCount();
            }

            // Add paging to the query.
            query = query.Skip(_currentPage * _pageSize)
                    .Take(_pageSize) as DataServiceQuery <Title>;

            return(query);
        }