EvaluateExpession in ExpressionBuilder
I need to implement own ExpressionBuilder. I know how to implement GetCodeExpression() so I'm able to do in markup: <%$ OwnBuilder: MyMethod(param) %>
But now I need to implement also the EvaluateExpression to return the result of my own method (to do something like <%$ OwnBuilder: param %>. How should the EvaluateExpression method be implemented? Something like this??:
public override object EvaluateExpression(object target, BoundPropertyEntry entry, object par开发者_开发百科sedData, ExpressionBuilderContext context)
{
return OwnExpressionBuilderPrivateMethod(entry.Expression);
}
and what about the GetCodeExpression()?
Thanks a lot.
The EvaluateExpression method is used when the CompilationMode is set to 'Never' and the ExpressionBuilder supports evalutions by overriding the SupportsEvaluate property (and returning 'true').
If you don't plan to support theses no-compile pages, the SupportsEvaluate returns false by default, so just implement an EvaluateExpression method that returns null.
In our ExpressionBuilder implementation, we support the <%$ OwnBuilder: param %> type of expression using the GetCodeExpression method.
精彩评论