Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PagingResult"/> class from a <see cref="PagingArgs"/> and optional total count.
        /// </summary>
        /// <param name="pagingArgs">The <see cref="PagingArgs"/>.</param>
        /// <param name="totalCount">The total record count where applicable.</param>
        /// <remarks>Where the <paramref name="pagingArgs"/> and <paramref name="totalCount"/> are both provided the <see cref="TotalPages"/> will be automatically created.</remarks>
        public PagingResult(PagingArgs pagingArgs, long?totalCount = null)
        {
            Check.NotNull(pagingArgs, nameof(pagingArgs));

            Skip       = pagingArgs.Skip;
            Take       = pagingArgs.Take;
            Page       = pagingArgs.Page;
            IsGetCount = pagingArgs.IsGetCount;
            TotalCount = (totalCount.HasValue && totalCount.Value < 0) ? null : totalCount;
            IncludeFields.AddRange(pagingArgs.IncludeFields);
            ExcludeFields.AddRange(pagingArgs.ExcludeFields);
        }
Exemple #2
0
 /// <summary>
 /// Appends the <paramref name="fields"/> to the <see cref="IncludeFields"/>.
 /// </summary>
 /// <param name="fields">The fields to append.</param>
 /// <returns>The current <see cref="WebApiRequestOptions"/> instance to support fluent-style method-chaining.</returns>
 public WebApiRequestOptions Include(params string[] fields)
 {
     IncludeFields.AddRange(fields);
     return(this);
 }