Ejemplo n.º 1
0
 public QueryInfo <T> AddPaging(int pageSize, int page)
 {
     return(new QueryInfo <T>(
                SortProperties?.Cast <QuerySortProperty <T> >().ToArray(),
                Filters,
                new QueryPaging(pageSize, page),
                Includes));
 }
Ejemplo n.º 2
0
        public QueryInfo <T> AddIncludes([NotNull] params Expression <Func <T, object> >[] includeExpression)
        {
            if (includeExpression == null)
            {
                throw new ArgumentNullException(nameof(includeExpression));
            }

            return(new QueryInfo <T>(
                       SortProperties?.Cast <QuerySortProperty <T> >().ToArray(),
                       Filters,
                       Paging,
                       (Includes ?? new string[0]).Concat(includeExpression.Select(e => EncodeMemberExpression(e.Body, e.Parameters[0]))).ToArray()));
        }
Ejemplo n.º 3
0
        public QueryInfo <T> AddSorting([NotNull] params QuerySortProperty[] sortings)
        {
            if (sortings == null)
            {
                throw new ArgumentNullException(nameof(sortings));
            }

            return(new QueryInfo <T>(
                       (SortProperties?.Cast <QuerySortProperty <T> >().ToArray() ?? new QuerySortProperty <T> [0]).Concat(sortings.Cast <QuerySortProperty <T> >()).ToArray(),
                       Filters,
                       Paging,
                       Includes));
        }
Ejemplo n.º 4
0
        public QueryInfo <T> AddSorting([NotNull] Expression <Func <T, object> > sortExpression, bool ascending = true)
        {
            if (sortExpression == null)
            {
                throw new ArgumentNullException(nameof(sortExpression));
            }

            return(new QueryInfo <T>(
                       (SortProperties?.Cast <QuerySortProperty <T> >().ToArray() ?? new QuerySortProperty <T> [0]).Concat(new [] { new QuerySortProperty <T>(sortExpression, ascending) }).ToArray(),
                       Filters,
                       Paging,
                       Includes));
        }
Ejemplo n.º 5
0
        public QueryInfo <T> AddFilter([NotNull] params QueryFilter[] filters)
        {
            if (filters == null)
            {
                throw new ArgumentNullException(nameof(filters));
            }

            return(new QueryInfo <T>(
                       SortProperties?.Cast <QuerySortProperty <T> >().ToArray(),
                       (Filters ?? new QueryFilter[0]).Concat(filters).ToArray(),
                       Paging,
                       Includes));
        }
Ejemplo n.º 6
0
        public QueryInfo <T> AddFilter([NotNull] Expression <Func <T, bool> > filterExpression)
        {
            if (filterExpression == null)
            {
                throw new ArgumentNullException(nameof(filterExpression));
            }

            return(new QueryInfo <T>(
                       SortProperties?.Cast <QuerySortProperty <T> >().ToArray(),
                       (Filters ?? new QueryFilter[0]).Concat(QueryFilter.Parse(filterExpression)).ToArray(),
                       Paging,
                       Includes));
        }