What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows  
Author Message
Blipwort





PostPosted: Windows Workflow Foundation, What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows Top

What are the alternatives to using GetActivityByName() in RuleConditions in XOML only workflows when re-hosting the Designer Control

It is unreasonable to expect customer business users to understand casting and write rule conditions of the form

((SomeNamespace.Workflow.Common.ActivityLibrary.ConsoleWritelineActivity)this.GetActivityByName("fred")).Message == "test"

What are my options here




Software Development for Windows Vista17  
 
 
Jon Flanders





PostPosted: Windows Workflow Foundation, What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows Top

Really the only options are either

a) Providing a custom Type type from your ITypeProvider. When you do that only those methods and properties that the Type type returns will be displayed. Of course in the end your Activity type must have those methods or properties at runtime - but at design time you can restrict the members the user sees.

b) Write your own rule editing dialog using whatever kind of simple syntax that you want for business users. Return a custom TypeDescriptor in your designer for your Activity type - and then for the property that relates to a rule - return a custom PropertyDescriptor. When the PropertyDescriptor is used - display your editor - and then translate your editor;s rule syntax into the syntax necessary to build the rule (you'll have ot use the CodeDom classes to do this).



 
 
Jake Pratt





PostPosted: Windows Workflow Foundation, What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows Top

I am in the same boat as you. I was hoping that this new CTP would correct this problem but it doesn't. I haven't tried creating a type provider yet but feel like it shouldn't be necessary.

I even tried to create a generic method on the workflow to get the activity but that didn't work either. I haven't tried it in the new CTP but maybe I will give it a shot.

If you find a better solution to this, let us know.


 
 
Tom Lake





PostPosted: Windows Workflow Foundation, What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows Top

Without writing a custom rule editor dialog, as Jon suggests, there isn't an alternative for V1.  If you are using a StateMachineWorkflow, Replicator, While or ConditionedActivityGroup in code only workflow you must use GetActivityByName, and cast, if you want to get the correct activity instance to work with also.

 
 
Blipwort





PostPosted: Windows Workflow Foundation, What are the alternatives to using GetActivityByName in RuleConditions in XOML only workflows Top

How do I plug in a custom Rule editing dialog (I am using Vihang's Designer rehosting example).

I'm afraid I don't understand what I should be doing with custom TypeDescriptors and PropertyDescriptors.

Would it have to be implemented for all custom activities What about activities developed by others