how to use code-separation mode to custom a state workflow RRS feed

  • Question

  • hi, folks
    i am developing a state workflow recently, i want the user can define their own states in the workflow, so i choose the code-separation mode,
    but i have a problem with the local service:
    every state must have it's own one or more EventDriven activity, these EventDrivent activity must bind to a local service event,
    then we can fire the event in host application to make the state change, but if the user add a state, then he need to add some EventDriven
    activity, and add the SetState activity in each EventDriven activity, then i have to add one or more new event in the local service. that means i need to modify the local service code to add a new event then bind the new state's EventDriven activity to it,
    i have an idea to resolve this problem:
    define a custom EventDriven activity, subscribe the custom activity to the same local service event, but every time the local service event occurred,
    all the event in the same state will be fired, so i set next state name into the event arguments, the custom EventDriven activity use the
    state name in the event arguments to judge if itself should be executed
      protected override ActivityExecutionStatus Execute(
                ActivityExecutionContext executionContext)
                          retun ActivityExecutionStatus.Closed;
                         return ActivityExecutionStatus.Executing;

    is my idea is correct?
    Tuesday, June 9, 2009 3:06 AM