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

Dictionary parameter issue #397

Closed
b0bi79 opened this issue Jul 6, 2020 · 3 comments
Closed

Dictionary parameter issue #397

b0bi79 opened this issue Jul 6, 2020 · 3 comments
Assignees

Comments

@b0bi79
Copy link

b0bi79 commented Jul 6, 2020

If pass Dictionary as a parameter for a lambda expression, then DynamicInvoke will return the first result each time. It looks like a cached result is returning.

        [Fact]
        public void EvalDictionaryParams2()
        {
            object CreateDicParameter(string name) => new Dictionary<string, object>
                {{"Name", new Dictionary<string, object> {{"FirstName", name }}}};

            var config = new ParsingConfig()
            {
                CustomTypeProvider = new DefaultDynamicLinqCustomTypeProvider()
            };
            var parType = new Dictionary<string, object>().GetType();
            var lambda = DynamicExpressionParser.ParseLambda(config, new [] {Expression.Parameter(parType, "item")}, typeof(object), "item.Name.FirstName").Compile();
            lambda.DynamicInvoke(CreateDicParameter("Julio")).Should().Be("Julio");
            lambda.DynamicInvoke(CreateDicParameter("John")).Should().Be("John");  // Failure. DynamicInvoke returns "Julio"
        }
@JonathanMagnan
Copy link
Member

Hello @b0bi79 ,

Thank you for reporting.

We will look at it.

Best Regards,

Jon


Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

JonathanMagnan added a commit that referenced this issue Jul 9, 2020
@JonathanMagnan
Copy link
Member

Hello @b0bi79 ,

Just to let you know we fixed the issue. We will complete our test tomorrow and probably release it during the weekend.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @b0bi79 ,

The v1.1.8 has been released.

Let us know if everything is now working as expected.

Best Regards,

Jon

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

2 participants