Esempio n. 1
0
        public SortCondition <TEntity> ThenByDescending(string propertySelector)
        {
            if (string.IsNullOrEmpty(propertySelector))
            {
                throw new ArgumentException("Selector string can not be null or empty", nameof(propertySelector));
            }
            var item = new SortItem
            {
                PropertySelector = propertySelector,
                SortDirection    = SortDirection.Descending
            };

            _sortItems.Add(item);
            return(this);
        }
Esempio n. 2
0
        public SortCondition <TEntity> ThenByDescending <TProperty>(Expression <Func <TEntity, TProperty> > selectorExpression)
        {
            if (selectorExpression == null)
            {
                throw new ArgumentException("Selector string can not be null or empty", nameof(selectorExpression));
            }
            var item = new SortItem
            {
                PropertySelector = GetSelectorStringFromExpression(selectorExpression),
                SortDirection    = SortDirection.Descending
            };

            _sortItems.Add(item);
            return(this);
        }
Esempio n. 3
0
        public static SortCondition <TEntity> OrderByDescending(string propertySelector)
        {
            if (string.IsNullOrEmpty(propertySelector))
            {
                throw new ArgumentException("Selector string can not be null or empty", nameof(propertySelector));
            }

            var result = new SortCondition <TEntity> {
                _entityType = typeof(TEntity)
            };
            var item = new SortItem
            {
                PropertySelector = propertySelector,
                SortDirection    = SortDirection.Descending
            };

            result._sortItems.Add(item);
            return(result);
        }
Esempio n. 4
0
        public static SortCondition <TEntity> OrderByDescending <TProperty>(Expression <Func <TEntity, TProperty> > selectorExpression)
        {
            if (selectorExpression == null)
            {
                throw new ArgumentException("Selector string can not be null or empty", nameof(selectorExpression));
            }

            var result = new SortCondition <TEntity> {
                _entityType = typeof(TEntity)
            };
            var item = new SortItem
            {
                PropertySelector = GetSelectorStringFromExpression(selectorExpression),
                SortDirection    = SortDirection.Descending
            };

            result._sortItems.Add(item);
            return(result);
        }
Esempio n. 5
0
        public SortCondition <TDestination> Cast <TDestination>() where TDestination : class
        {
            var result = new SortCondition <TDestination>
            {
                _entityType                  = typeof(TDestination),
                _parameterExpression         = _parameterExpression,
                _sortableParameterExpression = _sortableParameterExpression
            };

            foreach (var sortItem in _sortItems)
            {
                var newSortItem = new SortItem()
                {
                    PropertySelector = sortItem.PropertySelector,
                    SortDirection    = sortItem.SortDirection
                };
                result._sortItems.Add(newSortItem);
            }
            return(result);
        }