Beispiel #1
0
        public void ProcessCommand <TCommand, TResult>(TCommand command) where TCommand : ICommand
        {
            if (command == null)
            {
                throw new CerseilException("The command object cannot be null. You cannot process the command if it is null!");
            }

            var scheduledAction = new ScheduledAction <TCommand, TResult>(command);

            ManageAction <TCommand, TResult>(scheduledAction);
        }
Beispiel #2
0
 private void ManageAction <TCommand, TResult>(ScheduledAction <TCommand, TResult> scheduledAction) where TCommand : ICommand
 {
     if (IsInTransaction)
     {
         // Add action to the list
         Actions.AddAction <TCommand, TResult>(scheduledAction);
         IsDirty = true;
     }
     else
     {
         // Execute the single action
         scheduledAction.Execute();
         ActionResults.AddActionResult(scheduledAction.Result);
     }
 }
 public void AddAction <TCommand, TResult>(ScheduledAction <TCommand, TResult> action) where TCommand : ICommand
 {
     Actions.Add(action);
 }