Пример #1
0
        public Func<object[],object> ResolveFunction(string functionName)
        {
            Func<object[],object> function = Functions != null ? Functions.ResolveFunction(functionName) : null;

            if (function == null)
            {
                var args = new UnknownFunctionEventArgs(functionName, ContextObject);
                var evt = ResolveMissingFunction;
                if (evt != null)
                    evt(this, args);
                function = args.Function;
            }
            return function;
        }
Пример #2
0
        private void FunctionStore(object sender, SimpleExpressionEvaluator.Evaluation.UnknownFunctionEventArgs e)
        {
            PropertyPath path      = null;
            object       searchObj = null;

            path = e.ContextObject.ParsePropertyPath(e.FunctionName);
            if (path != null)
            {
                searchObj = e.ContextObject;
            }
            else
            {
                throw new UnknownFunctionException(e.FunctionName);
            }
            e.Function = functionArgs => path.Evaluate(searchObj);
        }
Пример #3
0
        public Func <object[], object> ResolveFunction(string functionName)
        {
            Func <object[], object> function = Functions != null?Functions.ResolveFunction(functionName) : null;

            if (function == null)
            {
                var args = new UnknownFunctionEventArgs(functionName, ContextObject);
                var evt  = ResolveMissingFunction;
                if (evt != null)
                {
                    evt(this, args);
                }
                function = args.Function;
            }
            return(function);
        }
        private void FunctionStore(object sender, SimpleExpressionEvaluator.Evaluation.UnknownFunctionEventArgs e)
        {
            PropertyPath path      = null;
            object       searchObj = null;

            path = e.ContextObject.ParsePropertyPath(e.FunctionName);
            if (path != null)
            {
                searchObj = e.ContextObject;
            }
            else
            {
                throw new InvalidOperationException("A function specified in the expression (" + e.FunctionName +
                                                    ") does not exist.");
            }
            e.Function = functionArgs => path.Evaluate(searchObj);
        }