c# - Pass a local variable to CodeMethodInvokeExpression in workflow foundation -
c# - Pass a local variable to CodeMethodInvokeExpression in workflow foundation -
i have rule validator using workflow foundation.when rule fails, need invoke handleerror function local error class object .but can't find way pass object.
it working fine when declare error class public variable
//rule action private void thenaction() { //local error object.i need pass variable handleerrorfunction errordata error = new errordata(); codemethodinvokeexpression codemethodinvokeexpression = new codemethodinvokeexpression(new codethisreferenceexpression(), "handleerror"); codedirectionexpression param1 = new codedirectionexpression(fielddirection.in, new codefieldreferenceexpression(new codethisreferenceexpression(), "error")); codemethodinvokeexpression.parameters.add(new codeprimitiveexpression("error " + statemachinetype.statemachineid)); codemethodinvokeexpression.parameters.add(param1); } //error handling function private void handleerror(errordata newerror) { //handle new error }
pass local variable codeprimitiveexpression
codemethodinvokeexpression.parameters.add(new codeprimitiveexpression(error));
c# workflow-foundation rule-engine business-rules
Comments
Post a Comment