示例#1
0
 /// <summary>
 /// Adds or Updates a state machine
 /// </summary>
 /// <param name="record">
 /// The tracking record 
 /// </param>
 /// <remarks>
 /// In cases where the workflow is loaded, the StateMachineStateRecord may be the first tracking record
 /// </remarks>
 private void AddOrUpdateStateMachine(StateMachineStateRecord record)
 {
     var history = this.maxHistory;
     this.currentStateMachine = this.stateMachines.AddOrUpdate(
         GetKey(record),
         s =>
             {
                 var info = new StateMachineInfo(history)
                     {
                         Name = record.Activity.Name,
                         InstanceState = ActivityInstanceState.Executing,
                         InstanceId = record.InstanceId
                     };
                 info.UpdateState(record);
                 return info;
             },
         (s, info) =>
             {
                 info.InstanceState = ActivityInstanceState.Executing;
                 info.UpdateState(record);
                 return info;
             });
 }