コード例 #1
0
        /// <summary>
        /// Retrieves a <see cref="PagedResult{TDto}"/> containing DTOs representing entities of the type handled by this service from the database, optionally
        /// filtered by a <paramref name="extraFilter"/> clause and a <paramref name="pagedSearchAndFilterInfo"/>.
        /// </summary>
        /// <param name="pagedSearchAndFilterInfo">Contains all the information for the dynamic filtering, paging, ordering and sorting of the results.</param>
        /// <param name="extraFilter">Adds an additional expression to filter the results.</param>
        /// <returns><see cref="PagedResult{TDto}"/> containing entity information.</returns>
        public virtual PagedResult <TDto> RetrieveAll(PagedSearchAndFilterInfo pagedSearchAndFilterInfo, Expression <Func <TEntity, bool> > extraFilter = null)
        {
            if (pagedSearchAndFilterInfo == null)
            {
                if (extraFilter == null)
                {
                    return(RetrieveAll());
                }
                else
                {
                    return(RetrieveAll(extraFilter));
                }
            }

            return(RetrieveAll <TEntity, TDto, TId>(pagedSearchAndFilterInfo, extraFilter));
        }
コード例 #2
0
ファイル: SearchUtil.cs プロジェクト: nicoloaiza/TestJaya
 public static IQueryable <TEntity> SkipTakeOrder <TEntity, TId>(this IQueryable <TEntity> set, PagedSearchAndFilterInfo filterInfo)
     where TEntity : IEntity <TId>
 {
     if (filterInfo == null)
     {
         return(set);
     }
     return(set.SkipTakeOrder <TEntity, TId>(filterInfo.Offset, filterInfo.Limit, filterInfo.OrderBy, filterInfo.OrderAsc));
 }
コード例 #3
0
 public IEnumerable <TId> GetAllIds(PagedSearchAndFilterInfo filters) => Repository.RetrieveAll <TEntity, TId>(filters, null, out int totalOfRecords).Select(e => e.Id);
コード例 #4
0
        /// <summary>
        /// Retrieves a <see cref="PagedResult{TDto}"/> containing DTOs representing entities of the type handled by this service from the database, optionally
        /// filtered by a <paramref name="extraFilter"/> clause and a <paramref name="pagedSearchAndFilterInfo"/>.
        /// </summary>
        /// <typeparam name="TOtherEntity">Type of the entity to retrieve.</typeparam>
        /// <typeparam name="TOtherDto">Type of the DTO to package the results.</typeparam>
        /// <typeparam name="TOtherId">Type of the Id of both <typeparamref name="TOtherEntity"/> and <typeparamref name="TOtherDto"/>.</typeparam>
        /// <param name="pagedSearchAndFilterInfo">Contains all the information for the dynamic filtering, paging, ordering and sorting of the results.</param>
        /// <param name="extraFilter">Adds an additional expression to filter the results.</param>
        /// <returns><see cref="PagedResult{TDto}"/> containing entity information.</returns>
        public virtual PagedResult <TOtherDto> RetrieveAll <TOtherEntity, TOtherDto, TOtherId>(PagedSearchAndFilterInfo pagedSearchAndFilterInfo, Expression <Func <TOtherEntity, bool> > extraFilter)
            where TOtherEntity : class, IEntity <TOtherId>
            where TOtherDto : class, IDto <TOtherId>
            where TOtherId : IEquatable <TOtherId>
        {
            var entities = Repository.RetrieveAll <TOtherEntity, TOtherId>(pagedSearchAndFilterInfo, extraFilter, out int totalOfRecords);

            return(packIntoPagedResult <TOtherEntity, TOtherDto, TOtherId>(entities, pagedSearchAndFilterInfo.Offset, pagedSearchAndFilterInfo.Limit, totalOfRecords));
        }