Пример #1
0
        /// <summary>Finds the page with the specified page index.</summary>
        /// <param name="pageIndex">The page index to find.</param>
        /// <exception cref="NotSupportedException">The data source does not support pagination.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="pageIndex"/> is less than 0.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <returns>The page.</returns>
        ICollectionPage <Character> IPaginator <Character> .FindPage(int pageIndex)
        {
            var reuqest = new CharacterPageRequest
            {
                Page    = pageIndex,
                Culture = ((ICharacterRepository)this).Culture
            };

            var response = this.serviceClient.Send <ICollection <CharacterDTO> >(reuqest);

            return(this.pageResponseConverter.Convert(response, pageIndex));
        }
Пример #2
0
        /// <summary>Finds the page with the specified page index.</summary>
        /// <param name="pageIndex">The page index to find.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that provides cancellation support.</param>
        /// <exception cref="NotSupportedException">The data source does not support pagination.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="pageIndex"/> is less than 0.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <exception cref="TaskCanceledException">A task was canceled.</exception>
        /// <returns>The page.</returns>
        async Task <ICollectionPage <Character> > IPaginator <Character> .FindPageAsync(int pageIndex, CancellationToken cancellationToken)
        {
            var reuqest = new CharacterPageRequest
            {
                Page    = pageIndex,
                Culture = ((ICharacterRepository)this).Culture
            };

            var response = await this.serviceClient.SendAsync <ICollection <CharacterDTO> >(reuqest, cancellationToken).ConfigureAwait(false);

            return(this.pageResponseConverter.Convert(response, pageIndex));
        }
Пример #3
0
        /// <summary>Finds the page with the specified page index.</summary>
        /// <param name="pageIndex">The page index to find.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that provides cancellation support.</param>
        /// <exception cref="NotSupportedException">The data source does not support pagination.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="pageIndex"/> is less than 0.</exception>
        /// <exception cref="ServiceException">An error occurred while retrieving data from the data source.</exception>
        /// <exception cref="TaskCanceledException">A task was canceled.</exception>
        /// <returns>The page.</returns>
        Task <ICollectionPage <Character> > IPaginator <Character> .FindPageAsync(int pageIndex, CancellationToken cancellationToken)
        {
            var reuqest = new CharacterPageRequest
            {
                Page    = pageIndex,
                Culture = ((ICharacterRepository)this).Culture
            };

            var response = this.serviceClient.SendAsync <ICollection <CharacterDataContract> >(reuqest, cancellationToken);

            return(response.ContinueWith(task => this.ConvertAsyncResponse(task, pageIndex), cancellationToken));
        }