コード例 #1
0
        public override Object Evaluate(EvaluateParams evaluateParams)
        {
            var scriptArgs = new ScriptArgs();
            var bindings   = new Dictionary <string, object>();

            bindings.Put(ExprNodeScript.CONTEXT_BINDING_NAME, evaluateParams.ExprEvaluatorContext.AgentInstanceScriptContext);
            for (int i = 0; i < Names.Length; i++)
            {
                bindings.Put(Names[i], Parameters[i].Evaluate(evaluateParams));
            }

            scriptArgs.Bindings = bindings;

            try
            {
                var result = _scriptAction.Invoke(scriptArgs);

                if (Coercer != null)
                {
                    result = Coercer.Invoke(result);
                }

                return(result);
            }
            catch (Exception e)
            {
                String message = "Unexpected exception executing script '" + ScriptName + "' for statement '" + StatementName + "' : " + e.Message;
                Log.Error(message, e);
                throw new EPException(message, e);
            }
        }
コード例 #2
0
        public object EvaluateInternal(ScriptArgs scriptArgs)
        {
            try
            {
                var result = _scriptAction.Invoke(scriptArgs);

                if (Coercer != null)
                {
                    result = Coercer.Invoke(result);
                }

                return(result);
            }
            catch (Exception e)
            {
                string message = "Unexpected exception executing script '" + ScriptName + "' for statement '" + StatementName + "' : " + e.Message;
                Log.Error(message, e);
                throw new EPException(message, e);
            }
        }