In the previous article, I focused on some issues related to workflow persistence.ArticleI will describe the integrity of the activity execution. And how to design our applicationsProgramInterface.
Most of our business data is generally stored in databases. Imagine that we operate on multiple data entries in the database in an activity, which may affect the next activity. However, if the activity is executed unexpectedly, how can we maintain consistency between the business data and the workflow status?
There are several aspects to use.
1. Use the workflow status data and business data in the same database to start transactions in the same connection. This is a bad choice, and we may need to separate the database. And ourCodeTransactions andSQLStatement processing. Another problem it brings is that we cannot implement distributed design, which is very bad.
Ii. Use in workflow designTransactionscope. This is a good choice, but it should be used by programmers rather than end users. If you want the customer to design the workflow by themselves, the staff will need some time of training to use this kind of stuff :).
3. This may be the preferred method for programmers to implement by themselves.IpendingworkInterface, used to encapsulate the processing of business data. The processing of these business data may come from a remoteWeb Service. At the same time, we also need to start it in the engineWorkflowcommitworkbatchserviceService.ReadingSDKI almost ignored this document, but for data integrity, this is crucial.
Another important thing I care about is how workflows affect our development model and how we organize user interfaces? The flexibility here is very high, and there is no unified understanding, but I feel this change to the traditional programming method. Here I will only talk about my own understanding. I hope to discuss it together.
Two types of applications can be divided based on the project progress.
I,The processing of business data has been complete. In this case, in order to make full use of existing code resources, the focus of the workflow is to organize the processing process of these business data. SuchCodeactivity,Listenaction,CallexternalmethodAnd other activities. This flowchart is customized by the Development Company for users. Users cannot customize this workflow!
II,To allow users to customize workflows completely, they must see custom activities so that users can easily associate custom activities with business activities. A technical problem in this way is to move the workflow designer to the application. For how to implement it, see the following resource link.
Here I will give a detailed description of the second case. Before workflow applications, the layout of my applications on the interface is mainly based on data. Multiple people may operate on the same heap of data based on permissions and solidified processes. After the workflow is introduced, the process is not fixed, which poses a challenge to the previous application mode: the application does not care about the next operation (engine-oriented ), there is only one option for submission or not. That is to say, a staff member does not need to select the appropriate data from the interface and clearly specifies the processing process in which the data will be placed. The situation becomes much simpler. He can directly view the data to be processed and make the processing result.
After the workflow is introduced, the operation modes of each staff member are unified: The data to be processed is directly displayed after the application is entered, and then submitted after the processing. Therefore, we have reason to unify the user interface. We only care about the processing of business data, but not the process of business data! To this end, we add a list of people to a custom activity, so that the user administrator can specify the list of people who can perform operations on the activity when customizing the workflow. Each staff member only lists the activities that can be operated upon logon. Select an activity to enter the working status. This is a good feeling.
In order to implement this function, we also need to make some articles. In order to process this function, the staff also need to interact with the workflow. Here we needEventdriven?, If it is used, our custom activities will become very complex or useless at all. If it is not used, how can a staff member tell the workflow processing result (the application and workflow instance work in two independent threads ). One way is to useManualworkflowschedulerserviceIn this way, the workflow engine and application can run in the same thread. Maybe there is a better way, please don't forget to tell me.
There is still one thing to do. We need to create one for each custom activity.PersistoncloseattributeAttribute. Important,We need a chance to stop the workflow,PersistoncloseattributeIs a good choice.
The user's administrator may change the process frequently. Make a version record and do not directly modify the running workflow instance! (This is not a workflow instance that cannot be modified, but is not recommended ). In this way, the old version is used to design the new workflow. They both run well. Why not.
It's almost done. Write this first. I hope to help you.
For more information about workflows, see my article below.
Some technical details and Application Experience of WWF (1)
Custom activity appearance during running of the rehosting WWF designer
Rehosting WWF designer-custom activity exterior
Rehosting WWF designerp drag activity from toolbox to designer
Rehosting WWF designer