I'm using DynamicExpressionParser.ParseLambda(ParsingConfig, ....)
which excepts ParsingConfig
where we can specify custom class to use its method in expression, which can be parsed as valid LambdaExpression
I've registered custom static class in ParsingConfig
by CustomTypeProvider
and can parse lambda expression as well.
but I need to create expression as StaticClassName.Method(input)
Is there any way where I can register my static class methods so I can call method directly directly without specifying class name? like Method(input)
in expression?
As DynamicLinq support many custom functions like iif(x, y, z)
which are available to use in expression directly as inbuilt method
Reference: https://dynamic-linq.net/expression-language
so was thinking if it provide any way to register custom class method, by which we can just use method name in expression or not?
Please let me know if there is any other way with/without DynamicLinq which allows such functionality.
Did you annotate your static class with the
[DynamicLinqType]
attribute?Example:
This is needed so that System.Linq.Dynamic.Core can handle these custom classes.
See also https://dynamic-linq.net/advanced-extending