I have created a simple order manager wf service (state machine) in WF4.
Order (EF entity) properties: Id, IsExport, NumOfProduct, ProductName, Status (waiting, approved, rejected).
State machine states:
1. OrderReceived (validation -> response activity) - Transitions:
isvalid true, save -> waiting
isvalid false -> Final state
2. Waiting (empty) - Transitions:
update(update order activity) -> waiting state approve(assign status field, update order and response activities) -> final state
3. Final state.
Correlation key: Order.Id
The implementation rised a few questions.
1. WF can manage one flow of the order instance, the order flow and the order entity is in one-one relation. Question is that where and how should I implement the listing of entityes according to a state filter (eg. approved orders or waiting orders). The list should be accessible via WCF service method.
2. What is the best practise to manage the batch data processing. (eg: Multiple order approval. "Foreach" in the client is not the required sln.)
3. The state of the order is symbolized by the "state activity persisted instances" and the entity's status field in the db as well. What is the best practise to decide the state of the entity, listing the active persisted activity instances in the defined state or select the entities from the db (by an activity) according to a state filter parameter?
Any help would be appreciated.