Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The execution result of DynamicExpressionParser.ParseLambda<JObject, bool> is incorrect. #906

Open
xiaoty9 opened this issue Mar 25, 2025 · 0 comments

Comments

@xiaoty9
Copy link

xiaoty9 commented Mar 25, 2025

    Customer customer = Customers[0];


    JsonObject jsonObject = new JsonObject();
    jsonObject.Add("City", "Paris");
    jsonObject.Add("Column2", 1);

    string query = " City = \"Paris\"";
    JObject jObject = new JObject { ["City"] = "Paris", ["Column2"] = 1 };

    var config = new ParsingConfig
    {
        ResolveTypesBySimpleName = true,
        AllowNewToEvaluateAnyType = true
    };

    var expression = DynamicExpressionParser.ParseLambda<JObject, bool>(config, true, query);
    string s = expression.ToString();
    var del = expression.Compile();
    var result = del.Invoke(jObject);

    Check.That(result).IsEqualTo(true);

The correct running result result is true.
When this code is set as ParseLambda<Customer, bool>, the result after running is true.

But set to ParseLambda<JObject, bool>
ParseLambda<JsonObject, bool>
ParseLambda<dynamic, bool>
After running this code, the result is false.

I wonder what's wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant