コード例 #1
0
        private static IEnumerable <LambdaExpression> GetExpressionList <T>(SortParameter par, IFilterSortPropResolver propResolver) where T : class, new()
        {
            IEnumerable <LambdaExpression> exprList = null;

            if (propResolver != null)
            {
                exprList = propResolver.FindResolution(par.Type ?? typeof(T), typeof(T), ListControlActionType.Sorting, par.ColumnName);
            }

            if (exprList == null || exprList.Count() == 0)
            {
                exprList = new LambdaExpression[] { par.GetLinqSortExpr <T>() };
            }

            return(exprList);
        }
コード例 #2
0
        private static object InvokeSortParameterOnQueryable <T>(object sourceList, SortParameter par, IFilterSortPropResolver propResolver, string ascMethodName, string descMethodName)
            where T : class, new()
        {
            bool isFirst = true;

            foreach (var expr in GetExpressionList <T>(par, propResolver))
            {
                if (isFirst)
                {
                    sourceList = InvokeSortParameterOnQueryable <T>(sourceList, expr, par.SortDirection, ascMethodName, descMethodName);
                    isFirst    = false;
                }
                else
                {
                    sourceList = InvokeSortParameterOnQueryable <T>(sourceList, expr, par.SortDirection, "ThenBy", "ThenByDescending");
                }
            }

            return(sourceList);
        }
コード例 #3
0
 private static object InvokeSortParameterOnEnumerableNext <T>(object sourceList, SortParameter par, IFilterSortPropResolver propResolver) where T : class, new()
 {
     return(InvokeSortParameterOnEnumerable <T>(sourceList, par, propResolver, "ThenBy", "ThenByDescending"));
 }
コード例 #4
0
 private static object InvokeSortParameterOnQueryableFirst <T>(object sourceList, SortParameter par, IFilterSortPropResolver propResolver) where T : class, new()
 {
     return(InvokeSortParameterOnQueryable <T>(sourceList, par, propResolver, "OrderBy", "OrderByDescending"));
 }