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

            SortItems.Add(sortItem);
            return(this);
        }
Example #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", "selectorExpression");
            }
            var sortItem = new SortItem()
            {
                PropertySelector = GetSelectorStringFromExpression(selectorExpression),
                SortDirection    = SortDirection.Descending
            };

            SortItems.Add(sortItem);
            return(this);
        }
Example #3
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", "selectorExpression");
            }
            var result = new SortCondition <TEntity>()
            {
                entityType = typeof(TEntity)
            };
            var sortItem = new SortItem()
            {
                PropertySelector = GetSelectorStringFromExpression(selectorExpression),
                SortDirection    = SortDirection.Descending
            };

            result.SortItems.Add(sortItem);
            return(result);
        }
Example #4
0
        public static SortCondition <TEntity> OrderByDescending(string propertySelector)
        {
            if (string.IsNullOrEmpty(propertySelector))
            {
                throw new ArgumentException("Selector string can not be null or empty", "propertySelector");
            }
            var result = new SortCondition <TEntity>()
            {
                entityType = typeof(TEntity)
            };
            var sortItem = new SortItem()
            {
                PropertySelector = propertySelector,
                SortDirection    = SortDirection.Descending
            };

            result.SortItems.Add(sortItem);
            return(result);
        }
Example #5
0
        public SortCondition <TDestionation> Cast <TDestionation>() where TDestionation : class
        {
            var sortCondition = new SortCondition <TDestionation>()
            {
                entityType                   = typeof(TDestionation),
                parameterExpression          = parameterExpression,
                orderableParameterExpression = orderableParameterExpression
            };
            var result = sortCondition;

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