locked
WF4 entity status handling, entities batch processing RRS feed

  • Question

  • I have created a simple order manager wf service (state machine) in WF4.

    simple order state machine workflow

    Order (EF entity) properties: Id, IsExport, NumOfProduct, ProductName, Status (waiting, approved, rejected).

    State machine states:
    1. OrderReceived (validation -> response activity)
    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.

    Thursday, April 12, 2012 9:17 AM

Answers

  • 1,3 The order list service should not be implemented in the order process workflow. As you mentioned, write a individual WCF service to provider list feature. To identify the entities' state, you can promote custom properties or deserialize instance data

    http://msdn.microsoft.com/en-us/library/ee364726.aspx

    http://msdn.microsoft.com/en-us/library/ee960223.aspx

    2 The multiple approved orders may have different states later,  to decouple the client behavior and order process, it would be better to Foreach in the client or encapsulate the batch approval in a workflow or method.

    • Marked as answer by Boolish Wednesday, April 18, 2012 11:52 AM
    Tuesday, April 17, 2012 7:11 AM