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

Support for dynamic types like expando object #36

Open
PeterHagen opened this issue Jul 11, 2021 · 0 comments
Open

Support for dynamic types like expando object #36

PeterHagen opened this issue Jul 11, 2021 · 0 comments

Comments

@PeterHagen
Copy link

I was testing Lambdaparser.eval() to handle user expression, where values are added to an expandoObject. This way I could create a dynamic object that contains properties which can be used in the expression. But it seems that expandoObjects and dynamic objects are not supported. Here is a snippet of my unit test with the ExpandoObject:

var lambdaParser = new LambdaParser();
var varContext = new Dictionary<string, object>(); 

dynamic dynamicDiplomas = new ExpandoObject();
dynamicDiplomas.ODB = true; /* this should come from a DB */
dynamicDiplomas.IDB = null;
varContext["diplomas"] = dynamicDiplomas;

expression = "diplomas.ODB || diplomas.IDB != null";

// MissingMemberException
Assert.Throws<System.Reflection.TargetInvocationException>(() => lambdaParser.Eval(expression, varContext));

Is this a known limitation?

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

No branches or pull requests

1 participant