public AggregateNode(string name) : base(null, name) { if (null == (this.methodInfo = AggregateNode.LookupFunc(name))) { throw InvalidExpressionException.UndefinedFunction(name); } }
public AggregateNode(string name) : base((ExpressionNode)null, name) { if ((object)(this.methodInfo = AggregateNode.LookupFunc(name)) == null) { throw InvalidExpressionException.UndefinedFunction(name); } }
public override object Eval(object row, object context) { ArrayList list = new ArrayList(); if (null != this.arguments && this.arguments.Count > 0) { for (int i = 0; i < this.arguments.Count; i++) { list.Add(NormalizeValue(this.arguments[i].Eval(row, context))); } } object[] args = list.ToArray(); object target = context; if (null != this.node) { target = this.node.Eval(row, context); } if (null == this.method) { this.method = this.GetMethod(target, args); } MethodInfo mi = this.method; //this.GetMethod(target, args); if (null == mi) { throw InvalidExpressionException.UndefinedFunction(name); } try { return(mi.Invoke(target, args)); } catch (Exception ex) { throw InvalidExpressionException.ErrorInFunc(mi.Name, ex); } }
public override object Eval(object row, object context) { ArrayList arrayList = new ArrayList(); if (this.arguments != null && this.arguments.Count > 0) { for (int index = 0; index < this.arguments.Count; ++index) { arrayList.Add(FunctionNode.NormalizeValue(this.arguments[index].Eval(row, context))); } } object[] array = arrayList.ToArray(); object target = context; if (this.node != null) { target = this.node.Eval(row, context); } if ((object)this.method == null) { this.method = this.GetMethod(target, array); } MethodInfo method = this.method; if ((object)method == null) { throw InvalidExpressionException.UndefinedFunction(this.name); } try { return(method.Invoke(target, array)); } catch (Exception ex) { throw InvalidExpressionException.ErrorInFunc(method.Name, ex); } }