public dynamic EvaluateExpression(Node tree, KEntity entity, Models.Pagination viewDetails, Dictionary <string, AliasReference> classNameAlias, dynamic businessData, dynamic kresult, string queryString, out bool hasData, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { string baseClassName = entity.Classes.Where(c => c.ClassType == KClassType.BaseClass).FirstOrDefault().Name; ReplaceExpressionsInTreeAsync(tree, baseClassName, viewDetails, classNameAlias, businessData, entity, kresult, queryString, isDetailsView, isNFSite, developerId); Token result = ParseTress.Parse(tree); if (result?.Type == null) { hasData = false; } else { hasData = result.Type != TOKENTYPE.NoData; } return(result?.Value ?? ""); } catch (Exception ex) { throw; } finally { stopwatch.Stop(); Helper.UpdateFunctionLog(functionLog, String.Format(Constant.EVALUATE_EXPRESSION, "Tree"), stopwatch.ElapsedMilliseconds); } }
public static object Execute(string expression) { //if(expression.Contains("[") || expression.Contains("]")) //{ // expression = expression.Replace("[", "").Replace("]",""); //} Node tree = LexerGenerator.Parse(expression); var result = ParseTress.Parse(tree); return(result.Value); }