コード例 #1
0
        /// <summary>
        /// Signals that the command is done executing regardless of the outcome.
        /// </summary>
        /// <param name="completionEventType">The event that was raised signaling that the execution is done.</param>
        internal void SignalExecutionDone(CommandExecutionEventType completionEventType)
        {
            if (Interlocked.CompareExchange(ref this.isDone, Constants.TrueInt, Constants.FalseInt) != Constants.FalseInt)
            {
                throw new InvalidOperationException("The command has already been marked as done.");
            }

            this.ExecutionLatency = (int)(DateTime.UtcNow - this.StartDateTime).TotalMilliseconds;
            this.AddEvent(completionEventType);
        }
コード例 #2
0
 /// <summary>
 /// Adds an event.
 /// </summary>
 /// <param name="eventType">An event.</param>
 internal void AddEvent(CommandExecutionEventType eventType)
 {
     this.events.Add(eventType);
 }
コード例 #3
0
 private void ExcecutionDone <TResponse>(BaseCommand <TResponse> command, CommandResult <TResponse> commandResult, CommandExecutionEventType eventType)
 {
     commandResult.SignalExecutionDone(eventType);
     this.eventPublisher.Publish(new CommandExecutedEvent(command.CommandKey, commandResult));
 }