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();

            sort.Name = parts[0]?.Trim();

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

            return(sort);
        }
        public EntitySelect(string query, string sort)
        {
            Query = query;

            var entitySort = EntitySort.Parse(sort);

            if (entitySort == null)
            {
                return;
            }

            Sort = new[] { entitySort };
        }
Пример #3
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 };
        }
 public EntitySelectQuery(IPrincipal principal, EntityFilter filter, EntitySort sort)
     : this(principal, filter, new[] { sort })
 {
 }