This project is read-only.

Purpose: Allow a mutating state step to set a trigger for the current workflow state.

An IFlowMutator instance is handed to the Execute method on a MutatableStateTask.  The task can use SetTrigger to declare a trigger to be set against the workflow upon completion.

A couple points to note on behavior:

  • If a SetTrigger call is made, subsequent entry actions on the current state will not be called.
  • If a SetTrigger call is not made, the subsequent entry actions will be called until all are executed.

Due to the notion that TTrigger can be a value or reference, Nullable<TTrigger> is not valid.  Therefore, if you need to determine whether a trigger has been set, checking IFlowMutator.IsSet is the appropriate mechanism.

   1:  public interface IFlowMutator<TTrigger, TTriggerContext>
   2:  {
   3:      /// <summary>
   4:      /// Gets the declared trigger.
   5:      /// </summary>
   6:      /// <value>The trigger.</value>
   7:      TTrigger Trigger { get; }
   8:   
   9:      /// <summary>
  10:      /// Gets the indicator of whether a trigger has been set
  11:      /// </summary>
  12:      /// <value><c>true</c> if this instance is set; otherwise, <c>false</c>.</value>
  13:      bool IsSet { get; }
  14:   
  15:      /// <summary>
  16:      /// Sets the trigger and associated context.
  17:      /// </summary>
  18:      /// <param name="trigger">The trigger.</param>
  19:      /// <param name="triggerContext">The trigger context.</param>
  20:      void SetTrigger(TTrigger trigger, TTriggerContext triggerContext);
  21:   
  22:      /// <summary>
  23:      /// Sets the trigger implying that the context remains the same.
  24:      /// </summary>
  25:      /// <param name="trigger">The trigger.</param>
  26:      void SetTrigger(TTrigger trigger);
  27:  }

Last edited Jan 1, 2011 at 11:14 PM by sdhebert, version 3

Comments

No comments yet.