Xoml And Declarative Rules
Last changed: -62.58.178.122

.
Summary

When using code based workflows with DeclarativeRules you can use an expression like:

        this.myCustomActivity1.TestValue == True

in the RuleConditionEditor and everything works just fine. When you create a XOML based workflow this does not work. The activities added have a private scope and are not visible by the rules engine. The expression above, even though the RuleConditionEditor claims it is perfectly valid, will produce an error with the following text:

        Activity 'ifElseBranchActivity1' validation failed: Property "Condition" has invalid value. Condition expression is invalid. The field "myCustomActivity1" on type "WorkflowConsoleApplication1.Workflow4" does not exist or is not accessible.

If the WorkflowCompiler is used, ie XOML with code beside, this is a compile time error. If the workflow is loaded as pure XOML this is a runtime error.

Changing the DeclarativeRules expression to:

        ((WorkflowConsoleApplication1.MyCustomActivity)this.GetActivityByName("myCustomActivity1")).TestValue

works exually well in both code and XOML.