1
Vote

Adding a Parameter in the EvaluateParameter delegate

description

Hi, can we have the ability to add new parameters to the the expression when the EvaluateParameter delegate is running. For example:
expression.EvaluateParameter += delegate(string name, ParameterArgs args)
{
    // get hold of the parameter
    string myParam = "[Sub] * [Expression]";

    args.Result = new Expression(myParam);
}
I've also tried
expression.EvaluateParameter += delegate(string name, ParameterArgs args)
{
    // get hold of the parameter
    string myParam = "[Sub] * [Expression]";

    expression.Parameters.Add(name, new Expression(myParam));
}
Neither of those work. Can this be made possible?

At the moment I'm using a LogicalExpressionVisitor to find all parameters needed in the calculation and all the calculation parameters (recursively), and I then look these up and add them as parameters. The parameters are currently public properties on a plain object.

comments