コード例 #1
0
        /// <summary>
        /// Create a limit and a offset parameters
        /// </summary>
        /// <param name="documentSearch">Document search engine</param>
        /// <param name="conditional">Conditional to add parameter</param>
        /// <param name="itemsPerPage">Quantity of items in one page</param>
        /// <param name="currentPage">Current page</param>
        /// <returns>Document search engine</returns>
        public static DocumentSearch <TDocument> PageIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, long itemsPerPage, long currentPage)
            where TDocument : Document
        {
            Checker.IsNull(conditional);

            if (conditional.Invoke())
            {
                documentSearch.Page(itemsPerPage, currentPage);
            }

            return(documentSearch);
        }