Example #1
0
        public static GetAllProjectedOptions <TEntity, TEntityPrimaryKey, TResponseDto> ResolveRepositoryGetAllProjectedOptions <TEntity, TEntityPrimaryKey, TResponseDto>(
            this ILocalizedPaginatedRequestDto <TResponseDto> request,
            Expression <Func <TEntity, TResponseDto> > projection)
            where TEntity : class, IEntity <TEntityPrimaryKey>
            where TResponseDto : class, IDto
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            if (projection is null)
            {
                throw new ArgumentNullException(nameof(projection));
            }

            var options = new GetAllProjectedOptions <TEntity, TEntityPrimaryKey, TResponseDto>
            {
                EntitiesToSkip = (request.PageIndex - 1) * request.PageSize,
                EntitiesToTake = request.PageSize,
                Projection     = projection,
                Sort           = request?.Sort
            };

            return(options);
        }
Example #2
0
 public static GetAllProjectedOptions <TEntity, int, TResponseDto> ResolveRepositoryGetAllProjectedOptions <TEntity, TResponseDto>(
     this ILocalizedPaginatedRequestDto <TResponseDto> request,
     Expression <Func <TEntity, TResponseDto> > projection)
     where TEntity : class, IEntity
     where TResponseDto : class, IDto
 {
     return(ResolveRepositoryGetAllProjectedOptions <TEntity, int, TResponseDto>(request, projection));
 }