Hi,
while working with WF 4.0 I noticed that the WorkflowApplication class exposes action properties (Aborted, Complete, etc...) instead of events. Is there a specific reason? When should I prefer action properties instead of events?
Thank you
Hi,
while working with WF 4.0 I noticed that the WorkflowApplication class exposes action properties (Aborted, Complete, etc...) instead of events. Is there a specific reason? When should I prefer action properties instead of events?
Thank you
Wow; I see what you mean; that really surprises me.
However, if you can't think of a good reason to use properties here (and I can't), then stick to event
s; they avoid a range of problems (accidental unsubscription and inappropriate invocation being the biggest).
The only thing I can think of is that maybe they needed this for serialization purposes, but I can think of other ways to crack that nut. Alternatively, maybe regular events don't make sense in the crazy "dependency property" / "attached property" / "routed event" world of WF.
Edit: the following isn't accurate, see Marc's comment below.
For one thing, events allow multiple handlers inherently while an Action
property only allows a single handler. Yes, the Action
property could do a broadcast itself, but that isn't very cohesive or idiomatic.
I'm with Marc on this one, I'm surprised they used Action
properties instead of standard events.
I sent an email to one member of the WF team and, kindly, he answered me. He told me that events and actions are almost equivalent, but the team had better feeling with the API using actions.