public void AddVariable(WorkflowVariableBase variable) { var type = KeyBuilder.ToKey(variable.GetType()); var existing = this.WorkflowVariables.FirstOrDefault(v => v.Type == type); if (existing != null) { existing.UpdateContent(variable); return; } this.WorkflowVariables.Add(WorkflowVariable.Create(this, variable)); }
/// <summary> /// Checks whether the workflow variable is present in the TransitionContext. /// </summary> /// <typeparam name="TVariable"></typeparam> /// <param name="transitionContext"></param> /// <returns></returns> public static bool HasVariable <TVariable>( this TransitionContext transitionContext ) { return(transitionContext.ContainsKey(KeyBuilder.ToKey(typeof(TVariable)))); }