/// <summary> /// // Load the Repository of all the functions from the CalculationManager. /// </summary> public void Load() { IEnumerable <CalculationFunction> calcFunctions = CalcManager.GetAllFunctions(); foreach (CalculationFunction calcFunction in calcFunctions) { _functions.Add(MathOpsFactory.CreateFunction(calcFunction.Name, calcFunction.ArgList, calcFunction.ArgDescriptors, calcFunction.Description)); } }
/// <summary> /// Finds the first function in the collection that satisfies the expression passed in /// </summary> /// <param name="expression"></param> /// <returns></returns> public IFunction FindSingle(System.Linq.Expressions.Expression <Func <IFunction, bool> > expression) { if (expression != null) { try { return(_functions.AsQueryable().First(expression)); } catch (InvalidOperationException ioex) { Dev2Logger.Log.Error(ioex); IFunction func = MathOpsFactory.CreateFunction(); return(func); } } return(null); }
/// <summary> /// Finds the first function in the collection that satisfies the expression passed in /// </summary> /// <param name="expression"></param> /// <returns></returns> public IFunction FindSingle(Expression <Func <IFunction, bool> > expression) { if (expression != null) { try { return(_functions.AsQueryable().First(expression)); } catch (InvalidOperationException ioex) { Dev2Logger.Error(ioex, GlobalConstants.WarewolfError); var func = MathOpsFactory.CreateFunction(); return(func); } } return(null); }