Esempio n. 1
0
        /// <summary>
        /// 编译
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="lambdaExpression"></param>
        /// <returns></returns>
        public static Func <TModel, TValue> Compile <TModel, TValue>(this Expression <Func <TModel, TValue> > lambdaExpression)
        {
            if (lambdaExpression == null)
            {
                throw new ArgumentNullException(nameof(lambdaExpression));
            }

            return(ExpressionCompiler.Process(lambdaExpression));
        }
Esempio n. 2
0
        private static Func <object, object> Wrap(Expression arg)
        {
            var lambdaExpr = Expression.Lambda <Func <object, object> >(Expression.Convert(arg, typeof(object)), _unusedParameterExpr);

            return(ExpressionCompiler.Process(lambdaExpr));
        }