Exemplo n.º 1
0
        public EntityQuery(string query, int page, int pageSize, string sort)
        {
            Query    = query;
            Page     = page;
            PageSize = pageSize;

            var entitySort = EntitySort.Parse(sort);

            if (entitySort == null)
            {
                return;
            }

            Sort = new[] { entitySort };
        }
Exemplo n.º 2
0
        public static EntitySort Parse(string sortString)
        {
            if (string.IsNullOrEmpty(sortString))
                return null;

            var parts = sortString.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
            if (parts.Length == 0)
                return null;

            var sort = new EntitySort { Name = parts[0]?.Trim() };

            if (parts.Length >= 2)
                sort.Direction = parts[1]?.Trim();

            return sort;
        }
Exemplo n.º 3
0
 public static IQueryable <T> Sort <T>(this IQueryable <T> query, EntitySort sort)
 {
     return(sort == null ? query : Sort(query, new[] { sort }));
 }
Exemplo n.º 4
0
 public EntityListQuery(EntityFilter filter, EntitySort sort)
     : this(filter, new[] { sort })
 {
 }