public static Expression <Func <TResult> > Invoke <TResult>(string query) { var expressionLexer = new ExpressionLexer(query); var expression = expressionLexer.BuildLambdaExpression(); var translator = new QueryTranslator(DefaultMemberNameProvider); return(translator.Translate <TResult>(expression)); }
public static Expression <Func <TResult> > Invoke <TResult>([NotNull] string query) { var expressionLexer = new ExpressionLexer(query); var expression = expressionLexer.BuildLambdaExpression(); var translator = new QueryTranslator(); return(translator.Translate <TResult>(expression)); }
public static Expression <Func <TModel, bool> > Deserialize <TModel>(string query) where TModel : class { if (string.IsNullOrWhiteSpace(query)) { return(model => true); } var expressionLexer = new ExpressionLexer(query); var expression = expressionLexer.BuildLambdaExpression(); var translator = new QueryTranslator(DefaultMemberNameProvider); var expr = translator.Translate <TModel, bool>(expression); return(expr); }
public static LambdaExpression Deserialize(Type modelType, string query) { if (string.IsNullOrWhiteSpace(query)) { return(null); } var expressionLexer = new ExpressionLexer(query); var expression = expressionLexer.BuildLambdaExpression(); var translator = new QueryTranslator(DefaultMemberNameProvider); var expr = translator.Translate(expression, modelType); return(expr); }