Replies: 3 comments
-
Good question. I have not tested this, so I don't know. I will try once I find some time. |
Beta Was this translation helpful? Give feedback.
-
It works :). One instance of CompositeActivity derived class is created during service initialization (this one bypasses IActivityTypeProvider ), I think it is creating workflow blueprint at that time (not sure). So it works in general but it is a bit confusing and one must be aware that class needs to work both created directly and through IActivityTypeProvider).... In general it would be good to document when and for what are instances of activity class created and how they behave. |
Beta Was this translation helpful? Give feedback.
-
Yeah the composite activity is a bit funny. It acts as both a workflow builder as well as an activity that can execute, giving it two separate lifetimes, each of them living in a different dimension. As you suggested in the other issue, we need to document this, including the various caveats to be aware of. I intend to fix this good with Elsa 3, which will have a different API when it comes to building workflows and nested activities, where everything will feel more natural because the structure will actually be intrinsically hierarchical like Windows Workflow Foundation. We will be able to do things like: public class MyWorkflow : Activity
{
Start = new Sequence
{
new WriteLine("Hello!"),
new MyComposite()
}
}
public class MyComposite : Activity
{
Start = new Sequence
{
new WriteLine("Hello from composite!"),
new WriteLine("Later!"),
}
} In the above example, composites behave exactly the same as any other activity. Anyway, that is neither there nor here, so for the time being we will document the current behavior. |
Beta Was this translation helpful? Give feedback.
-
Related to #1122.
I tried creating activity derived from CompositeActivity using IActivityTypeProvider and it seems that my activity object is sometime created through callbacks provided by IActivityTypeProvider and sometimes directly.
The code that creates my activity object directly seems to come from WorkflowBlueprintMaterializer class:
So my question is, is it possible to use composite activity and create it using IActivityTypeProvider?
Beta Was this translation helpful? Give feedback.
All reactions