Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to
In our Workflow application it was created a lot of  Workflow level Dependency properties that was used  to interchange data between different activities.
    Workflow.PropertyA=  Activity1.PropertyA
We believed that is a safe way to avoid concurrency problems. But it was WRONG.
Article ActivityExecutionContext in Workflows explains, that Workflow properties as a shared data between activities is not a safe method and can cause concurrency errors in case of CAG or similar usage.
Best solution is to use custom activities Dependency properties and direct binding between activities.
Activity2.PropertyA=  Activity1.PropertyA
The primary advantage to dependency properties is that they allow binding of property values to instance data at runtime. For example, you can bind the input property of one activity to an output property of another. The actual property values resulting from the binding is determined at runtime. Dependency properties are required when you want to bind properties from one activity to another. However, if you are binding an activity property to a workflow property, the workflow property is not required to be a dependency property. In this case, a normal C# property on the workflow class works fine.
Performance Characteristics of Windows Workflow Foundation tells to avoid using dependency properties if not necessary:
A dependency property is a powerful mechanism that helps you expose activity properties so they can be bound and shared within a workflow instance. There is a small performance overhead associated with this property type, especially when many dependency properties are being accessed from the workflow, but in most cases the overhead should be minimal.
Related links: DependencyProperty Class
           wdp snippet
Posted on Friday, September 25, 2009 10:18 PM Workflow | Back to top

Comments on this post: Using of Workflow Dependency properties.

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: