index > Windows Workflow Foundation > Validating wich activities I can insert on my custom activity.

Validating wich activities I can insert on my custom activity.

Hi.

I have a custom composite activity, and I don't want that an activity of the same type is inserted as child of it, in any level.

I don't have problems when I want to insert the same type activity as a direct child, because I can override the CanInsertActivities on the my designer.

But if I add a composite activity, I cannot find out how can I forbid to add an activity of the parent type inside it....

(Like a similar behaviour when adding a transactionscope that is indirectly a child of another transactionscope, but instead of showing the validator, I don't want the user to be allowed to add it...)

Thanks in advance,
Matias

Matt_
Matt,

I don't think you can do this 100% with the designers. As far as I know, there's no way to get notifications in the parent designer that a grandchild (at any arbitrary level) is getting inserted into the tree, so an activity validator would certainly be needed.

However, you can certainly have your activity designer prevent some common scenarios that would help the user:

1- You can prevent the user from adding a direct child of the same type
2- You can prevent the user from copy-pasting/dragging a direct composite activity child that contains an activity of the same as a direct/indirect child (i.e. you can prevent the user from dragging a sequence activity containing one of your activities into your activity).
3- You can prevent an instance of your activity being added anywhere there's an activity of the same type as a parent/grandparent.

Here's some sample code to do just that:

public class ParentActivityDesigner : SequenceDesigner
Tomas Restrepo
reply 2

You can use google to search for other answers

 

More Articles

• Webservice Multiple Methods
• Rules for ifActivity
• simple question
• Will there be a cost for WWF?
• WorkflowDefinition
• Binding list to activity property
• Error on build log? and why is this condition not working?
• How does it compare to the ISV's like K2 & Captaris Teamplate...
• BPI conference WF labs documentation
• InvokeWorkflow In the same context...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• No of States
• DependencyProperty error...
• Database monitor activity???
• Workflow in MOSS 2007 does not receive e
• workflow persistent
• Rehosting statemachine / freeform designer
• What is the current mechanism for data e
• Runtime Engine Durability
• Examples of workflows using Office 2007?
• Example faulthandleractivity Office Shar
• Workflow implementation in ASP.Net
• Pricing
• Visual Studio Tools for windows workflow
• Can the rules engine execute external co
• Workflow with current Sharepoint documents

Hot Articles

• Problem when serializing an array property
• Hosting workflow designer in asp.net web
• Beta 2 Installation Problems (Package Lo
• Add namespace to a web service
• Problem with running Workflow Monitor on
• Can I hide "standard" properti
• Inter-activity communication?
• "Workflow Patterns" evaluation
• Is there any in-built support for distri
• Workflow hangs after initialization with
• Tracking location question
• How to convert .dll back to .xoml?
• Lab4 problem : OrderCreated event is nev
• TypeProvider and persistence
• State Workflow - How can I do that?

Recommend Articles

• HIPAA 837 File Error
• Enable/disable activities based on worfk
• Rules for ifActivity
• Transaction Requires a Persistence Servi
• WWF Beta 1 cleanup tool ?
• Hands on Labs 2.2
• How to design on WF the back to activity?
• The underlying connection was closed: An
• about ui tool
• Modelling a collection and item relation
• Concurrency Best Practice
• XOML Version (beta 1)
• Workflow instance version issues
• Integration with VS2005 IDE
• Formatter used in Activity.Save