private Expression GetFilterLambda(out EvoQLExpression parse, out ParameterExpression parameter) { var expression = GetFilterExpression(out parse, out parameter); if (expression == null) { return(null); } var param = Expression.Parameter(typeof(Mention), "x"); Expression <Func <Mention, bool> > lambda = Expression.Lambda <Func <Mention, bool> >(ParameterRebinder.ReplaceParameters(expression, "x", param), param); return(lambda); }
private Expression GetFilterExpression(out EvoQLExpression parse, out ParameterExpression parameter) { parse = new EvoQLExpression(_query); if (parse.HadErrors) { string errorString = "EvoQL Error:\n"; foreach (string error in parse.Errors) { errorString += error + "\n"; } throw new EvoQLException(errorString); } parse.Tree.Init(); var root = parse.Tree; if (root is GetExpression) { var get = (GetExpression)root; var expression = get.CreateExpression(null); parameter = Expression.Parameter(typeof(Mention), "x"); if (expression == null) { return(null); } return(ParameterRebinder.ReplaceParameters(expression, "x", parameter)); } parameter = null; return(null); }