IsExecutable

CompositeActivity has anExecutableActivities property that returns all child activities that will be executed. I'm sureExecutableActivities takes into account whether or not a child activity is commented, but it may also include other factors.

I was hoping that Activity would have anIsExecutable property on it, but it does not. Is there another way to determine if a single activity is executable? Or could anIsExecutable property be added to the Activity class?

[508 byte] By [JaredBienz] at [2008-2-15]
# 1
Jared,

Thanks for the feedback. I've logged your suggestion for the property back with our product team. I could certainly see how having the property on the activity level would be useful. In your case, what scenario would be enabled by having this property?

Thanks,
Arjun

ArjunBanker at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

The original reason was for validation. We wanted to make a composite activity that contained several sub-branches (sequences). One of the branches was special in that we wanted to make sure it was always executable.

I realized yesterday that the current logic for determining if a branch is executable or not doesn't test for sub-activities. I suppose another question is: If a child is a composite activity that does not itself contain any activities, should it truely be considered executable?

Regards,
Jared

JaredBienz at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
I thought about this some more. The answer to my own question is obviously 'Yes'. An empty CompositeActivity should be considered executable, just as an empty method can be executed. It may be desierable in some circumstances for a branch to do nothing (i.e. skip steps that are performed if other conditions are met).

I guess what we wanted to know in our case was if the special branch was executable and actually had work to be performed. I don't know if PerformsWork makes sense as a property Smile, but I still think that at least IsExecutable should be there.

Regards,

Jared

JaredBienz at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Jared,

Couldn't you examine the ExecutableActivities.Count of each child activity? If the count was equal to zero, you would know the branch is empty.

Arjun

ArjunBanker at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
Well, I know I would need to check ExecutableActivities.Count as well as IsCommented. In addition to IsCommented, don't know what else the ExecutableActivites property takes into account.

It is easy for me to determine if a child activity contains other executable activities. It's also easy for me to determine if the child activity is commented out. But what other factors go into determineing if a child is executable? It seems there is more logic hidden in the ExecutableActivities property, and I feel that logic should be contained in a property on the activity itself.

As it is currently designed, if I want to determine if a child activity is executable I would have to do:



if (this.ExecutableActivities.Contains(child))
{
...
}

But this is very expensive because it requires generating the collection and then walking the collection looking for a particular instance. If each activity had an IsExecutable property, we could circumvent such work. It would also make your own internal logic for building the collection much simpler.

JaredBienz at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified