WorkflowDefinition vs WorkflowModel (vs WorkflowBlueprint) #643
-
Hello, first of all, thanks you for you amazing work, I'm really interested by Elsa Core and Designer capability. I would like to include this in a more large application and for this I need to understand the serialization of the different element. Using the Serialization Sample, I've understand that :
My idea was to start from a Code Workflow (IWorkflow) and try to serialize it to be sure that the WorkflowDefinition is correct but I've seen that there is no (simple?) way to go from a code Workflow to WorkflowDefinition. I've not seen the way. (from WorkflowBluePrint to WorkflowDefinition). After Looking at the Rest API , and WorkflowDefinitionService, I've seen that there is a other class WorkflowModel which seems to be used to go to the Workflow Definition (use by the designer?). Am I wrong? Am I missing something? What is the good way to go From CodeWorkfow to WorkflowDefinition? (and so after I can go back to instanciate a Workflow Instance, because I understand that the CodeWorkflow representation is "readonly" and I don't search to recreate a C# CodeWorkflow from serialization). Thanks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for the kind words! I'll try and explain the object model and relationships. It's pretty simple actually:
The responsibility of these providers are simply to return a list of Each provider has its own means of providing a workflow blueprint. I'll briefly describe each one of them: DatabaseWorkflowProvider This provider loads StorageWorkflowProvider This provider is similar to the ProgrammaticWorkflowProvider This provider is the one that relies on
** What is the good way to go From CodeWorkfow to WorkflowDefinition ** Short answer: there is no good way. Not out of the box at least. All of the providers mentioned are unidirectional: you can go from any source to a workflow blueprint, but there is no support to go the other way around. The reason for that is simple: programmatic/code workflows can run inline C# code. Imagine you want to convert such a workflow to a workflow definition that can be stored in the database or on disk. How would you do it in such a way that when you convert that workflow definition back to a blueprint (in order for the workflow engine to run a workflow instance of it), that inline C# code can still run? I'm not saying it's not possible, but I imagine it would require quite a bit of work to somehow extract the C# code to be persisted as part of its inline activity somehow, and when being deserialized, be parsed into actual C# code, or at least in compiled form so that it can be executed. Now, I haven't spent much time investigating this, so it's completely possible that there are simple ways to achieve this that I'm unaware of. I would love to hear about it if this is the case. |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words!
I'll try and explain the object model and relationships. It's pretty simple actually:
IWorkflowProvider
implementations, of which there are currently 3 that come with the box:The responsibility of these providers are simply to return a list of
IWorkflowBlueprint
implementations which are then stored (in a memory cache) for the workflow e…